title: How to add Expand/Collapse to a nested Gridview without using JQuery
body: <p>Is it possible to add expand colapse functionality in a nested grid view without using Jquery  or java script.</p>
  
  <p>If yes can someone give me an example?</p>
  
  <p>Below is the asp code for my nested gridview</p>
  
  <pre><code> &lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
      BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" 
      CellPadding="3" GridLines="Horizontal" 
      onrowdatabound="GridView1_RowDataBound" DataKeyNames="id1" &gt;
      &lt;AlternatingRowStyle BackColor="#F7F7F7" /&gt;
      &lt;Columns&gt;
          &lt;asp:TemplateField HeaderText="ID"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Eval("id1") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="Students"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:GridView ID="GridView2" runat="server" CellPadding="4" ForeColor="#333333" 
                      GridLines="None"&gt;
                      &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
                      &lt;EditRowStyle BackColor="#999999" /&gt;
                      &lt;FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
                      &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
                      &lt;PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /&gt;
                      &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" /&gt;
                      &lt;SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /&gt;
                      &lt;SortedAscendingCellStyle BackColor="#E9E7E2" /&gt;
                      &lt;SortedAscendingHeaderStyle BackColor="#506C8C" /&gt;
                      &lt;SortedDescendingCellStyle BackColor="#FFFDF8" /&gt;
                      &lt;SortedDescendingHeaderStyle BackColor="#6F8DAE" /&gt;
                  &lt;/asp:GridView&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
      &lt;/Columns&gt;
      &lt;FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" /&gt;
      &lt;HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" /&gt;
      &lt;PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" /&gt;
      &lt;RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" /&gt;
      &lt;SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" /&gt;
      &lt;SortedAscendingCellStyle BackColor="#F4F4FD" /&gt;
      &lt;SortedAscendingHeaderStyle BackColor="#5A4C9D" /&gt;
      &lt;SortedDescendingCellStyle BackColor="#D8D8F0" /&gt;
      &lt;SortedDescendingHeaderStyle BackColor="#3E3277" /&gt;
  
  &lt;/asp:GridView&gt;
  </code></pre>