CSS in 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.
 
G

Guest

Header style in ASP.NET is set for all headers. If you need something more
granular than this, you will have to get into some custom coding. To use it
in its normal methodology, make <HeaderStyle> a child of the DataGrid rather
than a child of the templated column.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top