ASP.NET - Gridview Header size - Asked By Krishna T on 27-Jun-12 07:28 AM

Hi,

How to set Gridview Only Header font-size in asp.net?
dipa ahuja replied to Krishna T on 27-Jun-12 07:32 AM
Right click on the smart tag of gridview and in the properties set the item's header style :


Ravi Maurya replied to Krishna T on 27-Jun-12 07:35 AM
Do like this

<HeaderStyle BackColor="PeachPuff" Font-Italic="false" ForeColor="SaddleBrown" Font-Names="Verdana"         BorderColor="Tan" Font-Size="Larger" />
Lalit M replied to Krishna T on 27-Jun-12 07:37 AM
show this code sample
---------

      <asp:GridView ID="gvTheGrid" runat="server" GridLines="Both" CellPadding="3" AutoGenerateColumns="false"
        BackColor="WhiteSmoke" AlternatingRowStyle-BackColor="Silver" HeaderStyle-Font-Size="Medium"
        OnPreRender="gvTheGrid_PreRender" CssClass="gvTheGrid">
        <Columns>
          <asp:BoundField DataField="ID" HeaderText="ID" HeaderStyle-Width="60" ItemStyle-Width="60" />
        </Columns>
      </asp:GridView>
   
OR

Check this will get good example
----------
http://asp-net-example.blogspot.in/2009/08/how-to-set-change-gridview-header-font_8184.html
http://asp-net-example.blogspot.in/2009/08/how-to-set-change-gridview-header-text.html
TSN ... replied to Krishna T on 27-Jun-12 08:15 AM
hi,....

You can set in both the ways , by programatically or using the tags..

By Programatically;

use this line of code .
GVSample1.HeaderStyle.Font.Size = FontUnit.Large;  

Using Tags:
<HeaderStyle   BackColor="DeepPink" Font-Size="Large"  />

Add the Above tag to the Gridview , and you can see the change to the gridview header 

Jitendra Faye replied to Krishna T on 27-Jun-12 08:55 AM
Use this code-

<asp:TemplateField ItemStyle-Font-Bold="true" HeaderStyle-Font-Size ="Medium">
          <ItemTemplate>
            <asp:Label ID="lbl" runat="server" Text='<%# Eval("sold") %>'></asp:Label>
          </ItemTemplate>
        </asp:TemplateField>

Try this and let me know.
Vikram Singh Saini replied to Krishna T on 27-Jun-12 10:26 AM
You can specify size also within gridview as:

<HeaderStyle Font-Size="12px" />