Add Item to DropDownList w/ DataSource

If you’re having problems adding an item to a dropdownlist because that ddl has a Datasource then this should work.

You need to set AppendDataBoundItems=”true” to add items to a datasource bound DropDownlist.

<asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataSource1"DataTextField="Short_Name" DataValueField="Short_Name" Width="150px" AppendDataBoundItems="true" >

<asp:ListItem Value="" Selected="True">Select an item</asp:ListItem>


Technorati Tags: ,


Leave a Reply