In Asp.net 2.0, an appenddatabounditems attribute is added, which is very convenient and allows you to add items to the listcontrol object before binding data. After data binding is executed, the item set contains items in the data source and previously added items. True if the list items are not cleared before data binding; false if the items set is cleared before data binding is executed. The default value is false. For example
< ASP: dropdownlist ID = "Dropdownlist1" Appenddatabounditems = "True" Runat = "Server" Performanceid = "Sqlperformance1" Datatextfield = "State" Datavaluefield = "State" > < ASP: listitem Text = "(Select a State )" Value = "" /> </ ASP: dropdownlist > < ASP: sqldatasource ID = "Sqlperformance1" Runat = "Server" Connectionstring = "<% $ Connectionstrings: pubsconnectionstring %>" Selectcommand = "Select distinct [State] from [authors]" > </ ASP: sqldatasource >
A prompt is added for the first item of dropdownlist, which requires the user to select. It does not disappear after being bound to sqldatasource or other data sources.
http://tech.sina.com.cn/s/s/2008-06-18/1211698093.shtml