D
David C
I have a drop down list control in a GridView that I want to grab the
SelectedValue in a SelectedIndexChanged event. I am getting an "Object
reference not set..." error on the line below that sets a reference to a
DropDownList via FindControl. I checked the spelling and control ID and all
is fine. Can someone help me find the reason for this error? Thanks.
Protected Sub ddlTypeID_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs)
Dim row As GridViewRow = GridView1.SelectedRow
Dim ddl As DropDownList = row.FindControl("ddlTypeID")
If ddl.SelectedValue = -1 Then
'some code here
End If
End Sub
SelectedValue in a SelectedIndexChanged event. I am getting an "Object
reference not set..." error on the line below that sets a reference to a
DropDownList via FindControl. I checked the spelling and control ID and all
is fine. Can someone help me find the reason for this error? Thanks.
Protected Sub ddlTypeID_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs)
Dim row As GridViewRow = GridView1.SelectedRow
Dim ddl As DropDownList = row.FindControl("ddlTypeID")
If ddl.SelectedValue = -1 Then
'some code here
End If
End Sub