In my master page, I have a ContentPlaceHolder defined:
In the page, I have the content defined:
<asp:Content runat="server" ID="conTrackingScripts" ContentPlaceHolderID="AfterScripts"> <!-- Blah --> </asp:Content>
Unfortunately, this code does not work:
conTrackingScripts.Visible = false;
The error given is "The name 'conTrackingScripts' does not exist in the current context. A quick Google search shows that many others have had the same issue. The solution is to use the following code instead:
(Master as MasterPage).FindControl("AfterScripts").Visible = false;
Substitute the name of your master page for "MasterPage", and the name of your ContentPlaceHolder for "AfterScripts" in the above code
It appears that you cannot edit properties on the content, you have to edit the ContentPlaceHolder directly.
Like this post? Please share it!