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 I broke the statement down to try and find the problem area.The UserResponse value is always populated correctly.
I can find the item by watching each item in the debugger.
so the item tha ...
Go to the complete details ...