is there a way to get element ID of an Content element loaded in the master page PlaceHolder?
For EX:
My master page,
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
Below is Other Page using Master page:
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
I am the child page
<asp:Label ID="lbl" runat="server"></asp:Label>
</asp:Content>
how to get the Content ID (“Content2”) in Master PageLoad.
Can Any one please suggest.
Thanks in advance
What you want to do is not possible. The
asp:Contentcontrols are not actually part of the page’s control hierarchy, as it says in this MSDN page:That’s why I asked about whether your ultimate goal was to access the controls in that section. If it is, you can get to them through the
ContentPlaceHoldercontrol, because at runtime all the controls that were in the Content section are inside of it. You can do this in your masterpage: