Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DataGrid.AllowSorting and CssClass

Reply
Thread Tools

DataGrid.AllowSorting and CssClass

 
 
=?Utf-8?B?a2g=?=
Guest
Posts: n/a
 
      08-02-2004
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


 
Reply With Quote
 
 
 
 
=?Utf-8?B?a2g=?=
Guest
Posts: n/a
 
      08-02-2004
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
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmVyZW15IERhdmlz?=
Guest
Posts: n/a
 
      08-02-2004
You could always use a child selector in your CSS rules, along the lines of
..yourHeaderStyle a { text-decoration: blink; }

"kh" wrote:

> 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
>
>

 
Reply With Quote
 
Joe Fallon
Guest
Posts: n/a
 
      08-02-2004
Thanks for posting.
I had the same problem.
--
Joe Fallon


"kh" <> wrote in message
news:B0D64541-EE6E-4F43-B388-...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
get and set an HTML contrls cssClass =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= ASP .Net 1 07-09-2006 08:28 PM
HTMLTable and CssClass motorhead_maniac ASP .Net 1 05-03-2006 03:51 PM
A question of (web)control and CssClass kurt sune ASP .Net 1 01-17-2006 08:47 PM
Problem using Webpartzone and CssClass =?Utf-8?B?Y2hyaXNmb3g=?= ASP .Net 1 11-18-2005 11:47 PM
CssClass and HTML file field control =?Utf-8?B?bXN1aw==?= ASP .Net 6 11-30-2004 09:41 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57