Align Header Text Center asp:GridView
<p>I am displaying some content in gridview , everything is working fine except the alignment of the grid.</p>

<p>I am trying to center-align the text of Header but nothing is working fine.</p>

<p>I tried this :</p>

<pre><code> &lt;asp:GridView ID="Gv_Edu" runat="server" BackColor="White" AutoGenerateColumns="false"
   BorderColor="#000000" BorderStyle="Solid" BorderWidth="1px" CellPadding="4"
  ForeColor="Black" OnRowDataBound="Gv_Edu_RowDataBound"&gt;
  &lt;Columns&gt;
&lt;asp:TemplateField HeaderText="Sr.No"&gt;
&lt;HeaderStyle HorizontalAlign="Center" /&gt;
&lt;ItemTemplate&gt;
   &lt;asp:Label runat="server" ID="srlbl" Text='&lt;%#Container.DataItemIndex+1 %&gt;'&gt;&lt;/asp:Label&gt;
&lt;ItemTemplate&gt;
  &lt;ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="10%" /&gt;
  &lt;/asp:TemplateField&gt;
    &lt;asp:BoundField HeaderText="Degree / Certificate" DataField="deg"&gt;
   &lt;ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="30%" /&gt;
  &lt;/asp:BoundField&gt;
    &lt;asp:BoundField HeaderText="Institute" DataField="inst"&gt;
    &lt;HeaderStyle HorizontalAlign="Center" /&gt;
     &lt;ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="20%" /&gt;
    &lt;/asp:BoundField&gt;
    &lt;asp:BoundField HeaderText="Program Duration" DataField="term"&gt;
      &lt;HeaderStyle HorizontalAlign="Center" /&gt;
      &lt;ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="10%" /&gt;
       &lt;/asp:BoundField&gt;
      &lt;/Columns&gt;
 &lt;HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" /&gt;
 &lt;/asp:GridView&gt;
</code></pre>