User1024180000 posted
I have an application which is structured like this:
Page1.aspx
UserControl1
UserControl2
Page2.aspx
UserControl1
UserControl2
Both pages are using same Master Page. However I'm unable to access User Control1 in Page1.aspx from UserControl1 in Page2.aspx. In Page2.aspx.cs I have tried this:
ContentPlaceHolder mpContentPlaceHolder = (ContentPlaceHolder)(Page.Master.FindControl("myContentPlaceHolder"));
Page1UserControl userCtrl = (Page1UserControl)(mpContentPlaceHolder.FindControl("controlName"));
I have already declared properties in User Controls so if I wanted to access MyProperty (Page1.aspx, UserControl1) value from User Control1 (Page2.aspx) I would like to do it like this:
userCtrl.MyProperty = "123";
I get an error message and userCtrl has a value of null. Actually userCtrl points to Page2.aspx instead of Page1.aspx. How can I change this ?