Assign CSS to DataGrid header

M

Maziar Aflatoun

Hi everyone,

I have a DataGrid with sort functionality enabled so that users can sort
each column by clicking on the column name. Can someone please tell me how
I can add CSS to my headers? no matter what I do I can't get class='' to
appear in my <a ...class=""></a>

Example

I want to apply it to HeaderText="Name"
<asp:TemplateColumn HeaderText="Name" SortExpression="Name">
<HeaderStyle Font-Bold="True" CssClass="normtext"></HeaderStyle>
<ItemTemplate>
<asp:label id="lblName" runat="server" CssClass="normtext"
Font-Bold=False text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:textbox id="txtName" CssClass="textbox1" runat="server"
Columns="30" text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'/>
</EditItemTemplate>
</asp:TemplateColumn>

I want in to appear in <a below...
<a href="javascript:__doPostBack('dgOpportunities$_ctl1$_ctl0','')">Name</a>

Thank you
Maz.
 
P

Peter Markusek

Maziar said:
Hi everyone,

I have a DataGrid with sort functionality enabled so that users can sort
each column by clicking on the column name. Can someone please tell me how
I can add CSS to my headers? no matter what I do I can't get class='' to
appear in my <a ...class=""></a>

This CSS works fine for me:

..normtext a:visited,a:active,a:link
{
text-decoration: none;
color: #DDDD00;
}

..normtext a:hover
{
text-decoration: underline;
}

,where normtext is CssClass in <HeaderStyle>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top