DataGrid.AllowSorting and CssClass

G

Guest

Hi. If I set DataGrid.AllowSorting=True my column headers are automatically rendered as hyperlinks. How can I explicitly tell the DataGrid what CssClass to use for these hyperlinks?

Note that this is not the same as this:
<HeaderStyle CssClass=myClass1></HeaderStyle>

I suppose I'm looking for something like:
<HeaderStyle CssClass=myClass1 HyperlinkCssClass=myClass2></HeaderStyle>

Thanks

kh
 
G

Guest

Played around a bit more and I can do this, but was hoping for a declarative method:

private void myDatagrid_ItemCreated(object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Header)
foreach(Control ctl in e.Item.Controls)
foreach(Control ctl2 in ctl.Controls)
if(ctl2.GetType().BaseType==typeof(LinkButton))
((LinkButton)ctl2).CssClass="clsSubHeading";
}

kh
 
G

Guest

You could always use a child selector in your CSS rules, along the lines of
..yourHeaderStyle a { text-decoration: blink; }
 

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,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top