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 happens
here's the code:
Thanks in advanceCode:Dim _ddl As DropDownList = New DropDownList() _ddl.ID = "ddl" + iCounter2.ToString() _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


Reply With Quote

Bookmarks