PC Review


Reply
Thread Tools Rate Thread

DataGrid.AllowSorting and CssClass

 
 
=?Utf-8?B?a2g=?=
Guest
Posts: n/a
 
      2nd Aug 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
 
      2nd Aug 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
 
      2nd Aug 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
 
      3rd Aug 2004
Thanks for posting.
I had the same problem.
--
Joe Fallon


"kh" <(E-Mail Removed)> wrote in message
news:B0D64541-EE6E-4F43-B388-(E-Mail Removed)...
> 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
Rate This Thread
Rate This Thread:

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
Datagrid AllowSorting property Carl Tribble Microsoft VB .NET 2 9th Oct 2004 08:37 PM
AllowSorting in datagrid Jason Microsoft ADO .NET 3 8th Sep 2004 09:28 PM
CollectionBase and Winforms DataGrid AllowSorting =?Utf-8?B?TWFyayBQaGlsbGlwcw==?= Microsoft Dot NET Framework 0 3rd Feb 2004 10:51 PM
DataGrid.AllowSorting Maurizio BELLANTONE Microsoft VB .NET 3 6th Sep 2003 05:01 PM
Export datagrid(with allowsorting) to Excel Cowboy \(Gregory A. Beamer\) Microsoft ASP .NET 6 4th Jul 2003 01:21 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:13 PM.