473,386 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

CSS in DataGrid Header

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$_ct l1$_ctl0','')">Name</a>

Thank you
Maz.
Nov 19 '05 #1
1 1530
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!
***************************

"Maziar Aflatoun" wrote:
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$_ct l1$_ctl0','')">Name</a>

Thank you
Maz.

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Matthew Wieder | last post by:
Hi - I have a datagrid that has a black header and the rows alternate white and gray. The problem is that until items are added to the grid, the grid appears as a large black rectangle, which is...
4
by: sumit | last post by:
Hi, I want to make a datagrid to be scrollable instead of paging in it. So i have put that datagrid html tags inside <div></div> tags and made that div scrollable. Due to this if i scroll down...
3
by: Ben | last post by:
Hi, I'm wondering how can i change the datagrid header text at runtime so that it keeps the sorting enabled? I can do; e.Item.Cells.Text = "foo"; But then foo is the text of the table cell...
3
by: AMD Desktop | last post by:
Hi, I need to add a header to a datagrid. This is the code I am trying to use: Dim dgStaffingReport As New DataGrid Dim dgitem As New DataGridItem(0, 0, ListItemType.Header) Dim mycell...
2
by: saleek | last post by:
I was wondering if there is a way I can add an extra header to a datagrid? I found this solution on the internet - but it seems quite old and didn't work for me. ...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
0
by: Daniel Doyle | last post by:
Hello and apologies in advance for the amount of code in this post. I've also sent this message to the Sharepoint group, but thought that ASP.NET developers may also be able to help, even though...
4
by: Mortar | last post by:
i need a datagrid with 2 header columns. The top one might have 1 column spanning 5 columns of the header row below it. what is the best way to do this? Could i have 2 datatables...1 filling the...
2
by: Santosh | last post by:
Dear all i want to bind data to datagrid header template i am wrtting follwing code it is displaying data with in item template not but it is display data in header template <asp:DataGrid...
2
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.