title: Gridview multiple header rows in c#
body: <p>How to show multirow header in gridview in asp.net ? </p>
  
  <p>I need use header template and item template and design it according to my requirements</p>
  
  <p>I have tried the code below but I don't understand because the columns are not aligned.</p>
  
  <p>The output is :</p>
  
  <p><a href="https://i.stack.imgur.com/9bqNx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9bqNx.png" alt="enter image description here"></a></p>
  
  <p>Please can you help me ?</p>
  
  <p>Thanks in advance for nay help.</p>
  
  <p>My code below</p>
  
  <pre><code>    &lt;asp:GridView ID="gvCustomers" runat="server"
          AutoGenerateColumns="false" CssClass="mGrid"
          HorizontalAlign="Center"
          Width="100"
          DataKeyNames="sID"&gt;
          &lt;Columns&gt;
  
  
              &lt;asp:TemplateField&gt;
                  &lt;ItemTemplate&gt;
                      &lt;asp:ImageButton ID="imgOrdersShow"
                          runat="server" OnClick="Show_Hide_OrdersGrid"
                          ImageUrl="/aspnet/img/plus.png"
                          CommandArgument="Show" /&gt;                
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
  
  
  
              &lt;asp:TemplateField&gt;
                  &lt;HeaderTemplate&gt;
                      &lt;th colspan="6"&gt;Category&lt;/th&gt;
                      &lt;tr class="gvHeader"&gt;
                          &lt;th style="width: 0px"&gt;&lt;/th&gt;
                          &lt;th colspan="3"&gt;Hardware&lt;/th&gt;
                          &lt;th colspan="3"&gt;Software&lt;/th&gt;
                      &lt;/tr&gt;
                      &lt;tr class="gvHeader"&gt;
                          &lt;th&gt;&lt;/th&gt;
                          &lt;th&gt;S. No.&lt;/th&gt;
  
                      &lt;/tr&gt;
                  &lt;/HeaderTemplate&gt;
                  &lt;ItemTemplate&gt;
                      &lt;td&gt;test1&lt;/td&gt;
                      &lt;td&gt;test2&lt;/td&gt;
                      &lt;td&gt;test3&lt;/td&gt;
                      &lt;td&gt;test4&lt;/td&gt;
                      &lt;td&gt;test5&lt;/td&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
  
  
          &lt;/Columns&gt;
      &lt;/asp:GridView&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/lfIsi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lfIsi.png" alt="enter image description here"></a></p>