asp.net.ph

GridView.HeaderStyle Property

System.Web.UI.WebControls Namespace   GridView Class


.NET Framework version 2.0

Sets or retrieves the style properties for the header section of a GridView control.

Syntax


Script GridView.HeaderStyle.Property [ = enumValue ]

Property Value

A TableItemStyle object that defines the style properties for the header section of a GridView.

Remarks

Use this property to provide a custom style for the header row in a GridView control. Common style attributes that can be set include forecolor, backcolor, font, and content alignment within the cell. Providing different item styles enhances the appearance of the GridView control.

The HeaderStyle subproperties can be set declaratively using either of the following methods:

  • Include an attribute in the opening tag of the GridView control in the form HeaderStyle-Property
    <asp:gridview ... 
       headerstyle-property=value
       ... >
    
    </asp:gridview>
  • Include a <HeaderStyle> element between the opening and closing tags of the GridView control
    <asp:gridview ... >
    
       <headerstyle
          ... property definitions here />
    
    </asp:gridview>

The subproperties can also be set programmatically in the form HeaderStyle.Property.

For a list of style properties that can be set, see the TableItemStyle class.

NOTE: The ShowHeader property must be set to true for this property to have any effect.

Example

The below snippet shows setting the HeaderStyle property of a GridView control at design time.

<asp:gridview id = "myGrid" runat = "server" cellpadding=5>

   <headerstyle
      backcolor = "maroon"
      forecolor = "khaki"
      font-bold font-italic />

</asp:gridview>

 Show me 

See Also

GridView Members   ShowHeader   FooterStyle Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph