System.Web.UI.WebControls Namespace GridView Class
.NET Framework version 2.0
Sets or retrieves the style properties for the alternating rows in a GridView control.
Script |
GridView.AlternatingRowStyle.Property [ = enumValue ] |
A TableItemStyle object that defines the style properties for the alternating rows in a GridView.
Use this property to provide a custom style for the alternating rows in a GridView control. Common style attributes that can be set include forecolor, backcolor, font, and content alignment within the cell. Providing different row styles enhances the appearance of the GridView control.
The AlternatingRowStyle subproperties can be set declaratively using either of the following methods:
The subproperties can also be set programmatically in the form AlternatingRowStyle.Property.
For a list of style properties that can be set, see the TableItemStyle class.
The below snippet shows how to set the AlternatingRowStyle for a GridView control at design time.
<asp:gridview id = "myGrid" runat = "server"
width=90% cellpadding=5
font-size = "8pt">
<headerstyle
backcolor = "maroon"
forecolor = "khaki"
font-bold />
<alternatingrowstyle
backcolor = "lightyellow" />
</asp:gridview>
EditRowStyle RowStyle SelectedRowStyle HeaderStyle FooterStyle