title: Parent gridview
body: <p>I have a grid view " GridViewTtransmittals" with 2 child grid view </p>
  
  <pre><code>Child 1: GridViewTranstoCon (parent GridViewEfile) 
  Child 2: GridViewEfile
  </code></pre>
  
  <p>GridViewEfile (child2) itself is child of child1 " GridViewEfile"
  Now I like to define GridViewEfile_RowDeleting but I have error (GridViewTranstoCon' does not exist in the current context)
  Please help what is the problem?</p>
  
  <pre><code> protected void GridViewEfile_RowDeleting(object sender, GridViewDeleteEventArgs e)
   {
       GridView Efile = sender as GridView;
      var parentrow1 = (GridViewRow)Efile.Parent.Parent;
      var parentrow2 = (GridViewRow)Efile.Parent.Parent.Parent;
      //  int transid = Convert.ToInt32(GridViewTtransmittals.DataKeys[e.RowIndex].Value);
  
      int transid = Convert.ToInt32(GridViewTtransmittals.DataKeys[parentrow2.RowIndex].Value);
  
      GridView GridViewTranstoCon = GridViewTtransmittals.FindControl("GridViewTranstoCon") as GridView;
  
      int transmittoconid = Convert.ToInt32(GridViewTranstoCon.DataKeys[parentrow1.RowIndex].Value);
      int FileId = Convert.ToInt32(Efile.DataKeys[e.RowIndex].Value);
  
      //Also step into this and see what it's doing
      OnDeleteEfile(FileId, transmittoconid, transid);
  }
  </code></pre>
  
  <p>Markup is like below:</p>
  
  <pre><code> &lt;asp:GridView ID="GridViewTtransmittals" runat="server" AutoGenerateColumns="False" 
            BorderStyle="None" ShowHeader="False" Width="100%" DataKeyNames="TransID"  onrowdatabound="GridViewTtransmittals_RowDataBound"
          onrowdeleting="GridViewTtransmittals_RowDeleting"&gt;
            &lt;columns&gt;
                &lt;asp:TemplateField&gt;
                    &lt;ItemTemplate&gt;
                        &lt;asp:RadioButton ID="RadioButton1" runat="server" GroupName="Transmittal" AutoPostBack="True" 
          OnCheckedChanged="RadioButton1_CheckedChanged" /&gt;
  
                    &lt;/ItemTemplate&gt;
                &lt;/asp:TemplateField&gt;
              &lt;asp:hyperlinkfield DataNavigateUrlFields="TransId" 
                DataNavigateUrlFormatString="~/Copy of Transmittal.aspx?TransId={0}" DataTextField="TRANSMITTAL" 
                HeaderText="Transmittal" /&gt;
              &lt;asp:CommandField ButtonType="Button" ShowDeleteButton="true" /&gt;
  
  &lt;asp:TemplateField HeaderText = "TRANSMITtoCon"&gt;
  &lt;ItemTemplate&gt;
  
                   &lt;asp:GridView ID="GridViewTranstoCon" runat="server" AutoGenerateColumns="False" CellPadding="4"
                      ForeColor="#000000" GridLines="Both" onrowdeleting="GridViewTranstoCon_RowDeleting" DataKeyNames="TransmittoconID"&gt;
               &lt;AlternatingRowStyle BackColor="Yellow" /&gt;
                      &lt;Columns&gt;
                        &lt;asp:BoundField DataField="TRANSMITtoCon" HeaderText= "TRANSMITtoCon" &gt;
                         &lt;ItemStyle Width = "20%" /&gt;
                        &lt;/asp:BoundField&gt;
                        &lt;asp:CommandField ButtonType="Button" ShowDeleteButton="true" /&gt;
                       &lt;/Columns&gt;
                       &lt;EditRowStyle BackColor="#7C6F57" /&gt;
           &lt;FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" /&gt;
          &lt;HeaderStyle BackColor="Red" Font-Bold="True" ForeColor="White" /&gt;
          &lt;PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" /&gt;
          &lt;RowStyle BackColor="#E3EAEB" /&gt;
          &lt;SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" /&gt;
                      &lt;/asp:GridView&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
  
              &lt;asp:TemplateField HeaderText = "E-FILES"&gt;
  &lt;ItemTemplate&gt;
  
                   &lt;asp:GridView ID="GridViewEfile" runat="server" AutoGenerateColumns="False" CellPadding="4"
                      ForeColor="#000000" GridLines="Both"  DataKeyNames="FileID"&gt;
               &lt;AlternatingRowStyle BackColor="Yellow" /&gt;
                      &lt;Columns&gt;
                       &lt;asp:TemplateField HeaderText = "E-FILES"&gt;
                    &lt;ItemTemplate&gt;
  
                        &lt;asp:LinkButton HeaderText = "E-FILES" ID="LinkButton1" runat="server" OnCommand="LinkButton1_Command" CommandName="Download" CommandArgument='&lt;%#Eval("FileID")%&gt;'&gt;&lt;%#Eval("FileName")%&gt; &lt;/asp:LinkButton&gt;
  
                         &lt;/ItemTemplate&gt;
                &lt;/asp:TemplateField&gt;
                 &lt;asp:CommandField ButtonType="Button" ShowDeleteButton="true" /&gt;
  
                       &lt;/Columns&gt;
                       &lt;EditRowStyle BackColor="#7C6F57" /&gt;
           &lt;FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" /&gt;
          &lt;HeaderStyle BackColor="Red" Font-Bold="True" ForeColor="White" /&gt;
          &lt;PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" /&gt;
          &lt;RowStyle BackColor="#E3EAEB" /&gt;
          &lt;SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" /&gt;
                      &lt;/asp:GridView&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
  
  
  
               &lt;/columns&gt;
  </code></pre>
  
  <p></p>