Hi,
I am using asp.net.2.0 and sqlserver2005. I'm using a dropdownlist in a EditItemTemplate of a formview.
Here is my code.
<td align="left"
nowrap="nowrap" valign="middle">
<asp:DropDownList ID="ddInvType"
runat="server"
DataSourceID="sdsInvoiceType"
DataTextField="InvoiceTypeID"
DataValueField="InvoiceTypeID"
SelectedValue='<%#
Bind("InvType") %>' Width="100px">
</asp:DropDownList>
</td>
<asp:SqlDataSource ID="sdsInvoiceType"
runat="server"
ConnectionString="<%$ConnectionStrings:ss
%>"
SelectCommand="SELECT Invoice.InvoiceTypeID FROM Invoice ORDER BY Invoice.InvoiceType"> </asp:SqlDataSource>
I need to display the dropdownlist with the default value like 'None' while the field have no data(InvType is null or zero). As the field is Integer type i cant set 'None' in the field value of that table.
Please help me how to display default value in dropdownlist, while at the same time dropdownlist should load all of its data?
Remember to click “Mark as Answer” on the post, if it helps you.