D
David C
I have a GridView of contacts that contains an embedded gridview of multiple
phones for that particular contact. I have a LinkButton on the contacts
GridView that refers to the Select command and when I click it the embedded
GridView of phones becomes visible. Now I would like to have it toggle so
that if the embedded GridView is visible, it will become Visible = False.
Below is the code I have but it creates an error "Object reference not set
to an instance of an object" c on the first IF statement. Can someone
advise? Code is below:
Protected Sub LBtnMorePhones_Click(ByVal sender As Object, ByVal e As
CommandEventArgs)
txtcnid.Text = e.CommandArgument
Dim row As GridViewRow = gvContacts.SelectedRow
If Not row.FindControl("gvMorePhones") Is Nothing Then
Dim varControl
varControl = row.FindControl("gvMorePhones")
If Not varControl Is Nothing Then
varControl.Visible = Not varControl.Visible
End If
End If
End Sub
phones for that particular contact. I have a LinkButton on the contacts
GridView that refers to the Select command and when I click it the embedded
GridView of phones becomes visible. Now I would like to have it toggle so
that if the embedded GridView is visible, it will become Visible = False.
Below is the code I have but it creates an error "Object reference not set
to an instance of an object" c on the first IF statement. Can someone
advise? Code is below:
Protected Sub LBtnMorePhones_Click(ByVal sender As Object, ByVal e As
CommandEventArgs)
txtcnid.Text = e.CommandArgument
Dim row As GridViewRow = gvContacts.SelectedRow
If Not row.FindControl("gvMorePhones") Is Nothing Then
Dim varControl
varControl = row.FindControl("gvMorePhones")
If Not varControl Is Nothing Then
varControl.Visible = Not varControl.Visible
End If
End If
End Sub