I have a DataBound DropDownList that is loading fine, but i’d like to insert another item that says “–Select–” or something instead of having the first DataBound item automatically display.
Is there an easy way to do this or do I need to manually add a dummy item?
Here is my code:
MyContext fc = new MyContext ();
ddl.DataSource = fc.SomeTable;
ddl.DataBind();
After you do the databind do:
This will add it as the first item in the list.
Alternatively, you can add a new ListItem instead of a string, so you can have an actual value instead of a string as drop down list value.
So you can do something like: