PDA

View Full Version : CssClass not working in .skin file



Fleewood
08 Dec 2011, 03:57 PM
Hi, I have used the .skin file previously correctly with the TextBox but I have just tried to change the GridView style with css via the .skin file but it isn't working, this is the code I have.

.aspx file


<asp:GridView ID="grid" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:BoundField DataField="City" HeaderText="City" />
<asp:BoundField DataField="MobilePhone" HeaderText="Mobile Phone" />
</Columns>
</asp:GridView>


.skin file


<asp:TextBox runat="server" ForeColor="blue" />
<asp:GridView runat="server" CssClass="GridMain" CellPadding="4" GridLines="None">
<RowStyle CssClass="GridRow" />
<SelectedRowStyle CssClass="GridSelectedRow" />
<HeaderStyle CssClass="GridHeader" />
</asp:GridView>


.css file


.GridMain
{
border-right:gainsboro thin solid;
border-top:gainsboro thin solid;
border-left:gainsboro thin solid;
border-bottom:gainsboro thin solid;
background-color:#333333;
width:400px;
}

.GridRow
{
background-color:#FFFAFA;
}

.GridSelectedRow
{
background-color:#E6E6FA;
}

.GridHeader
{
background-color:#ADD8E6;
font-weight:bold;
text-align:left;
}


Like I said I have used this .skin file with the TextBox and it works perfect but won't work with GridView.

Any ideas why this isn't working?

Thanks