Author: Shareb | Posted on: 10/12/2009 1:27:55 AM | Views : 263

Hi,

I'm creating a drop down list at runtime, specifying the DataSourceID property to a SqlDataSource.
I want to add a ListItem at the beginning of the DropDownList and have it as the selected item but nothing from what I want happens

here's the code:

Dim _ddl As DropDownList = New DropDownList() _ddl.ID = "ddl" _ddl.DataSourceID = "RatingScalesSqlDataSource" _ddl.DataTextField = "ScaleDescEn" _ddl.DataValueField = "ScaleID" Dim emptyListItem As ListItem = New ListItem("--Select--", "") _ddl.Items.Add(emptyListItem) _ddl.Items.FindByValue("").Selected = True
Thanks in advance

...

Go to the complete details ...