Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How do I set the CssClass for a GridView sorting link?

Thread Tools

How do I set the CssClass for a GridView sorting link?
Posts: n/a

If I set "AllowSorting=true" on a GridView in ASP.NET 2.0, it adds a
hyperlink to the top of each column. How do I apply a CssClass directly
to that hyperlink? I've tried every property I can find.



Reply With Quote
Posts: n/a
I wrote a function that iterates thru all the controls recursively in
any given control and returns all of a certain type. You can use this
to find all the linkbutton in ItemCreated and set the cssclass.

private static void FindControlRecursive(Type type, Control control,
ref ArrayList arrayListControls, bool recurse)
foreach (Control subcontrol in control.Controls)
if (recurse)
FindControlRecursive(type, subcontrol, ref arrayListControls,

if (subcontrol.GetType ().IsSubclassOf (type) || subcontrol.GetType
() == type)

Reply With Quote

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
GridView working with External Stylesheet and CssClass JB ASP .Net 2 10-03-2009 06:57 PM
Problems with GridView.CssClass and Selections Jonathan Wood ASP .Net 1 05-11-2008 11:52 PM
gridview rowdatabound change cssclass and selectedrowstyle cssclasshelp Peter ASP .Net Web Controls 0 05-10-2007 12:52 PM
GridView:HyperLink; how to set CssClass in Skin? Daves ASP .Net 0 05-19-2006 12:41 PM
gridview skin, set cssclass for hyperlinks Daves ASP .Net 0 05-12-2006 07:02 AM