User-740453238 posted
I have a nested gridivew. When I try to add record to the child gridivew I can't figure out the ID of the parent. I am pressing a + sign to open up the child. If I click on select then I have no problem. However the + doesn't actually
select the parent. So how can I do this. Either figuring out how to find the ID or causing the record to be selected when I click on the +. You can see my tries below.
If e.CommandName = "AddComment" Then
'Dim gvUniqueID As String = [String].Empty
Try
Dim gvTemp As GridView = DirectCast(sender, GridView)
Dim strTicketsID1 As Integer = GridView1.SelectedValue 'GridView1.DataKeys(e.row).Values("TicketID")
'Dim key As String = Me.GridView1.DataKeys(TryCast(TryCast(row.NamingContainer, GridView).NamingContainer, GridViewRow).RowIndex).Value.ToString()
Dim ParentKey As Integer = Convert.ToInt32(DirectCast(gvTemp.Parent.FindControl("TicketID"), TextBox).Text)
'Dim ParentKey1 As Integer = Convert.ToInt32(DirectCast(GridView1.Rows(gvTemp.Parent).FindControl("TicketID"), Label).Text)
' Dim Gv2Row As GridViewRow = DirectCast(DirectCast(sender, GridView).NamingContainer, GridViewRow)
'Dim Childgrid As GridView = DirectCast(gvTemp.Parent.Parent, GridView)
'Dim Gv1Row As GridViewRow = DirectCast(Childgrid.NamingContainer, GridViewRow)
'' Dim b As Integer = Childgrid.RowIndex