I am new to ASP.NET
Basically, I have a format style that using for a Gridview (example below). This is inside the Gridview. Anytime I create another Gridview in a different page. I would have to copy and paste this style again. I wonder if there is another way (like CSS class) where I can globally save this code and just Reference it in the Gridview?
<AlternatingRowStyle ForeColor="Black" BackColor="#F7F6F3" VerticalAlign="top" />
<HeaderStyle BackColor="#B5DAFF" Font-Bold="True" HorizontalAlign="center" />
<FieldHeaderStyle BackColor="#CCCCCC" Font-Bold="True" ForeColor="Black"
Width="20%" HorizontalAlign="Right" />
<CommandRowStyle BackColor="Green" Font-Bold="True" />
<PagerStyle BackColor="Gold" ForeColor="White" HorizontalAlign="Center" />
<FooterStyle Font-Bold="True" ForeColor="White" BackColor="Gold" />
Thank you,
You can use these properties of the GridView:
CssClass,PagerStyle-CssClassandAlternatingRowStyle-CssClass. Then you just define the styles globally in your .css file using the classes you just applied to the GridView.Like this sample:
CSS
This link has full details: ASP.NET GridView makeover using CSS