How do I set the CssClass for a GridView sorting link?

R

rob

Hi,

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.

Thanks,

Rob
 
B

bcutting

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,
true);

if (subcontrol.GetType ().IsSubclassOf (type) || subcontrol.GetType
() == type)
arrayListControls.Add(subcontrol);
}
}
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top