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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mufasa

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

    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.


  • Frederik Van Lierde

    #2
    Re: Finding a control inside of a content piece of a master page.

    Use Reflection.

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

    FieldInfo[] _listControls =
    _object.GetType ().GetFields(Bi ndingFlags.Flat tenHierarchy |
    BindingFlags.In stance | BindingFlags.No nPublic))

    // Then search in the Array.



    It is important to have BindingFlags.Fl attenHierarchy

    I hope this brings you into the right direction

    Frederik Van Lierde

    Comment

    Working...