If I use a DropDownList:
<asp:DropDownList ID="DropDownListSubContractors" runat="server"
DataTextField="Company_Name" DataValueField="id">
</asp:DropDownList>
What attribute do I use/set that allows me to use '---Select---' as initial option on the drop down, instead of the first value in the list.
You can use
<asp:DropDownList ID="DropDownListSubContractors" runat="server" AppendDataBoundItems="true" DataTextField="Company_Name" DataValueField="id">
<asp:ListItem Text="---Select---" Value="0" />
</asp:DropDownList>
Or you can add this dynamically at code behind like this
DropDownListSubContractors.Items.Add(new ListItem("---Select---", "0"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With