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

  • Thread starter Thread starter Mufasa
  • Start date Start date
M

Mufasa

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.
 
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
 
Back
Top