Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>first of all to access any control in master page(which is inside ContentPlaceHolder) one way is, first access the ContentPlaceHolder than in this CPH(ContentPlaceHolder) find you desired control.(if its on root i.e outsede CPH than access it without finding CPH)</p> <p><strong>Case if LoginView is on root of Main.master:</strong></p> <pre><code> LoginView logInView = (LoginView)this.Master.Master.FindControl("HeadLoginView"); HyperLink hyp2 = (HyperLink)logInView.FindControl("HyperLink1"); </code></pre> <p><strong>Case if LoginView inside ContentPlaceHolder of Main.master:</strong></p> <p>In Your scenario you have nested master pages..so if you define like this: asuming that in you main.master their is only one ContentPlaceHolder Id = ContentPlaceHolder1 </p> <pre><code>ContentPlaceHolder User_cph1 = (ContentPlaceHolder)this.Master.Master.FindControl("ContentPlaceHolder1"); </code></pre> <p>It will give you the User.master ContentPlaceHolder as their is only one CPH in masterpage(its assumption)</p> <p>so one way is to define new contentplaceholde("ContentPlaceHolder2") in main.master and put you LoginView Control in it, than use this code :(purpose of defining new CPH is only to validate that this CPH not being used by user.master)</p> <pre><code>ContentPlaceHolder Main_cph2 = (ContentPlaceHolder)this.Master.Master.FindControl("ContentPlaceHolder2"); LoginView logInView = (LoginView)Main_cph2.FindControl("HeadLoginView"); HyperLink hyp2 = (HyperLink)logInView.FindControl("HyperLink1"); </code></pre> <p>it will first find CPH in Main.Master</p> <p>than Find HeadLoginView in CPH </p> <p>than find HyperLink in HeadLoginView </p> <p>Hope it is some cleared to you :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload