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

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.
 
F

Frederik Van Lierde

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
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top