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

Discussion in 'ASP .Net' started by rob@thinknow.co.uk, Feb 10, 2006.

  1. Guest

    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
     
    , Feb 10, 2006
    #1
    1. Advertising

  2. Guest

    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);
    }
    }
     
    , Feb 10, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Randall Parker
    Replies:
    3
    Views:
    3,937
    Eliyahu Goldin
    Jan 19, 2006
  2. Daves
    Replies:
    0
    Views:
    746
    Daves
    May 12, 2006
  3. Daves
    Replies:
    0
    Views:
    2,368
    Daves
    May 19, 2006
  4. =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?=

    get and set an HTML contrls cssClass

    =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?=, Jul 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    328
    =?UTF-8?B?R8O2cmFuIEFuZGVyc3Nvbg==?=
    Jul 9, 2006
  5. lander
    Replies:
    2
    Views:
    322
    lander
    Mar 9, 2008
Loading...

Share This Page