Ali
Ali

Reputation: 3615

I want to override the gridview HeaderStyle. Currently skin(through theme) is applying

I want to override the gridview HeaderStyle.
Currently skin(through theme) is applying on my gridview.
I only want to override is headerstyle,want to give my own CSS.
How can I do this.

Thanks in advance

Edit________________

 <asp:GridView ID="gvSports" runat="server"> 
      <HeaderStyle BackColor="Blue" ForeColor="Navy" />

....List of Columns

</asp:Gridview>

Skin File(App_Themes>Default>skinFile.skin)-----------------------------

asp:GridView runat="server">
    <HeaderStyle BackColor="Green" />
    <PagerStyle BackColor="Gray" />
</asp:GridView>

I want to give blue color(backcolor) in HeaderStyle, but it takes Green due to skin file(please check skin code)

I only want to override HeaderStyle

Upvotes: 1

Views: 4032

Answers (1)

Sven Bieder
Sven Bieder

Reputation: 5681

You can make a new skin with a skinid for this purpose.

<asp:GridView ID="gvSports" runat="server" SkinID="BlueGrid"> 

....List of Columns

</asp:Gridview>

and for the skins you keep your old one for the gridvievs generally and an additional one for your special case.

<asp:GridView runat="server">
    <HeaderStyle BackColor="Green" />
    <PagerStyle BackColor="Gray" />
</asp:GridView>

<asp:GridView SkinID="BlueGrid" runat="server">
    <HeaderStyle BackColor="Blue" />
    <PagerStyle BackColor="Gray" />
</asp:GridView>

Upvotes: 1

Related Questions