locate label on content page

Posted by VictorS on Stack Overflow See other posts from Stack Overflow or by VictorS
Published on 2010-03-24T19:42:56Z Indexed on 2010/03/24 21:23 UTC
Read the original article Hit count: 292

Filed under:
|

I am trying to locate a label on a content page from within User Control(ascx)

 Page p = this.Page;
 //this line causes application to unload with no exception
 ContentPlaceHolder cp = (ContentPlaceHolder)p.Master.FindControl("Content2");
 Label label = (Label)cp.FindControl("SomeLabel");

It just unloads itself with no exception mesage. Why does it happen?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about master-pages