If I write ...
... it creates an <option> in a <select> drop-down list.Code:<asp:ListItem Value="0">--Select Category --</asp:ListItem>
To populate the drop-down list I am doing something like this to get the list items from a database:
... which works fine. But, when I populate the list from the database it deletes the <asp:ListItem> so it no longer says --Select Category-- at the top of the list. The list only contains the items from the database.Code:conn.Open() reader = categoryComm.ExecuteReader() categoryList.DataSource = reader categoryList.DataValueField = "CategoryID" categoryList.DataTextField = "Category" categoryList.DataBind() reader.Close()
How can I get the --Select Category-- option to stay there?
Thanks for any help.




Reply With Quote