Obtain the control in a multi-layer master:
Contentplaceholder holder = (Contentplaceholder) Master. Master. findcontrol ( " Contentplaceholder1 " );
Contentplaceholder holder2 = (Contentplaceholder) Holder. findcontrol ( " Contentplaceholder2 " );
Textbox txt_test = (Textbox) holder2.findcontrol ( " Test " );
Call the control of the user control itself:
(Label) This . Findcontrol ( " Label1 " ). Text = " 123 " ;
Note that page. findcontrol cannot be used to locate the issue. Use this
Call the control on the user control on the host interface:
System. Web. UI. usercontrol UC = (System. Web. UI. usercontrol) page. findcontrol ( " Webusercontrol1 " );
(Label) UC. findcontrol ( " Label1 " ). Text = " 123 " ;
Call the controls on the user control on the host interface containing the master:
Contentplaceholder holder = (Contentplaceholder) page. master. findcontrol ( " Contentplaceholder1 " );
System. Web. UI. usercontrol UC = (System. Web. UI. usercontrol) Holder. findcontrol ( " Webusercontrol1 " );
(Label) UC. findcontrol ( " Label1 " ). Text = " 123 "
Set the value in user B control from user a control:
System. Web. UI. usercontrol UC = (System. Web. UI. usercontrol) page. findcontrol ( " Webusercontrol1 " );
(Label) UC. findcontrol ( " Label1 " ). Text = " 123 " ;
Overall feeling: It is troublesome to use findcontrol on pages where a master or even a master is embedded. I don't know if there is any good solution.