Finding controls inside nested master pages

Posted by evanmortland on Stack Overflow See other posts from Stack Overflow or by evanmortland
Published on 2009-04-08T01:15:22Z Indexed on 2010/04/08 5:13 UTC
Read the original article Hit count: 295

Filed under:
|
|
|

I have a master page which is nested 2 levels. It has a master page, and that master page has a master page.

When I stick controls in a ContentPlaceHolder with the name "bcr" - I have to find the controls like so:

 Label lblName =(Label)Master.Master.FindControl("bcr").FindControl("bcr").FindControl("Conditional1").FindControl("ctl03").FindControl("lblName");

Am I totally lost? Or is this how it needs to be done?

I am about to work with a MultiView, which is inside of a conditional content control. So if I want to change the view I have to get a reference to that control right? Getting that reference is going to be even nastier! Is there a better way?

Thanks

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#