Finding a control inside of a content piece of a master page.

Discussion in 'ASP .Net' started by Mufasa, Aug 21, 2008.

  1. Mufasa

    Mufasa Guest

    So how can I find a control that is in the content section of a master page.

    Essentially I want to do a search of all controls on the page. If they are
    child of another control I want to include that in my search so I don't have
    to keep drilling down through each of the objects.

    TIA - Jeff.
    Mufasa, Aug 21, 2008
    #1
    1. Advertising

  2. Use Reflection.

    using System.Refelction;
    .....
    // Somewhere in the code where you need to search

    FieldInfo[] _listControls =
    _object.GetType().GetFields(BindingFlags.FlattenHierarchy |
    BindingFlags.Instance | BindingFlags.NonPublic))

    // Then search in the Array.



    It is important to have BindingFlags.FlattenHierarchy

    I hope this brings you into the right direction

    Frederik Van Lierde
    http://www.SilverSandsAssociates.com
    Frederik Van Lierde, Aug 22, 2008
    #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. Replies:
    2
    Views:
    459
    Siberwulf
    Sep 15, 2006
  2. jobs
    Replies:
    1
    Views:
    445
    clintonG
    Dec 13, 2006
  3. Poofactory
    Replies:
    2
    Views:
    624
  4. Nathan Sokalski
    Replies:
    25
    Views:
    1,401
    Nathan Sokalski
    Mar 4, 2010
  5. Patrick Plattes

    Download a file piece by piece

    Patrick Plattes, Nov 30, 2006, in forum: Ruby
    Replies:
    2
    Views:
    193
    Patrick Plattes
    Nov 30, 2006
Loading...

Share This Page