//Code here to populate DropDownList
DropDownListID.Items.Insert(0, new ListItem("Default text", "Default value")
This will add a ListItem to index 0, which will be the first ListItem.
In .NET 2.0, this can be done declaratively using the AppendDataBoundItems property. This will append all data-bound ListItems to the DropDownList, leaving those you add manually as the first selections.
Solution by : Ryan Olshan
ASPInsider | Microsoft MVP, ASP.NET
http://ryanolshan.com
No comments:
Post a Comment