I have a bunch of dropdowns in a gridview and I populate them through a datasource.
On the databound event i need to change the selected item to the actual selected value from db.
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left
Dim ddl As DropDownList = CType(e.Row.FindControl("ddProfileResponses"), DropDownList)
Dim QuestionID As String = CType(e.Row.FindControl("QuestionID"), Label).Text
Dim UserResponse As String = db.GetUserResponse(QuestionID, Userid) Dim itm As ListItem = ddl.Items.FindByValue(CStr(UserResponse))
itm.Selected = True
The UserResponse value is always populated correctly.
I can find the item by watching each item in the debugger.
so the item that I want to select does infact exist in the DropDownList
The FindByValue simply does not return the item
I'm scratching my head here. Any help would be ...
Go to the complete details ...