U
UGH
I am looping the grid rows to set the values in the dropdownlists. I keep
getting a run time error "Object reference not set to an instance of an
object." The error occurs on line where it says liitem=
dp.items.findbyvalues(st). I am not sure what I am doing wrong. I included
my codes so someone can point out my mistake. Thanks.
Private Sub reset_values()
Dim i As Long
Dim dp As DropDownList
Dim intIndex As Int32
Dim liItem As ListItem
Dim st As String
For i = 0 To grdAct.Items.Count - 1
dp = CType(grdAct.FindControl("dpl"), DropDownList)
st = grdAct.Items(i).Cells(5).Text
liItem = dp.Items.FindByValue(st) ( error occurs on this line )
intIndex = dp.Items.IndexOf(liItem)
dp.SelectedIndex = intIndex
Next
End Sub
getting a run time error "Object reference not set to an instance of an
object." The error occurs on line where it says liitem=
dp.items.findbyvalues(st). I am not sure what I am doing wrong. I included
my codes so someone can point out my mistake. Thanks.
Private Sub reset_values()
Dim i As Long
Dim dp As DropDownList
Dim intIndex As Int32
Dim liItem As ListItem
Dim st As String
For i = 0 To grdAct.Items.Count - 1
dp = CType(grdAct.FindControl("dpl"), DropDownList)
st = grdAct.Items(i).Cells(5).Text
liItem = dp.Items.FindByValue(st) ( error occurs on this line )
intIndex = dp.Items.IndexOf(liItem)
dp.SelectedIndex = intIndex
Next
End Sub