.NET Questions (CLOSED)

Questions and Answers on any aspect of .NET. Now closed.

This discussion group is now closed.

Have a question about .NET development? Try stackoverflow.com, a worldwide community of great developers asking and answering questions 24 hours a day.

The archives of .NET Questions contain years of Q&A. Even older .NET Questions are still online, too.

need some help with FindControl (asp.net 2.0 C#)


I have a page inside a Master Page.  This page loads a user control (UC1).  This user control loads another UserControl (UC2) into an area on the MasterPage.  This is a header area and uc2 is a form with a button. 

What I need to do is, when the uc2 button is clicked, it needs to change something in a div on uc1.  What I can't figure out is how to do a FindControl to locate the div on uc1 from uc2....

Hope at least some of that made sense - anyone give me a shove in the right direction?

Thursday, January 25, 2007
You can set up a recursive FindControl, as discussed at

However, I'd recommend an approach with less coupling.  For example, have uc1 expose a public method that allows that div to be updated, and then have the page expose a "wrapper" method that calls the uc1 method.  Then uc2 can just call the page's method.

Does that make sense?
JacobM Send private email
Thursday, January 25, 2007
right, so I add a public property to UC1, a method to the Page which returns that property, and UC2 calls that method.

I think I get that ;-)  Still a bit new to things like this, kind of picking it all up as I go,  Thanks for the advice.
Friday, January 26, 2007
sorry, I'm gonna sound really dumb now - how do I call a public method on the page from UC2, as UC2 is dynamically created by UC1?  I can't get VS2005 to let me call it by just doing methodName();
Friday, January 26, 2007
if I've got this straight, the control structure is (abbreviated)

- UC2
- ContentForm1 - UC1

If that's the case, UC2 can address UC1 through the ContentForm1's control structure:
Patrick Send private email
Sunday, January 28, 2007

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz