Find component in ASP.NET form at run-time

S

Sean Winstead

At design-time, it's possible to use
WebControl.Site.Container.Components to find a component (i.e., not a
WebControl). At run-time, WebControl.Site always appears to be null.
Is there a way to get access to the same information at run-time, so
that I can find a component on the form? Or is there a way to make
sure WebControl.Site is available?
 
S

Sean Winstead

Did you try:

this.Page.FindControl( "TheIdOfTheControl")?

Yes, it will only find components that inherit from Web.UI.Control and
so does not see plain ol' components.
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top