I am looking to add a blank default item to a dropdown list in an ASP.net form.
I can not add the item directly to the database in this situation.
I have tried the following code for the DropdownList however the item did not appear:
<asp:DropDownList ID="C_DepartmentID" runat="server" AutoPostBack="True" DataSourceID="D_DEPTs"
DataTextField="Name" DataValueField="ID" Width="16em">
<asp:ListItem Value="0" Selected="true">Select Department</asp:ListItem>
I Then set the AppendDataBoundItems="True"
This does make the blank item appear in the list, however the side effect is that if the conditions populating the list change- the list items from the new parameters are appended to the old and both can be selected. This can obviously cause some big problems.
Is there a fix for this side effect, or perhaps another method of adding this blank default ?
As always thank you for your help!