I have a Master Page
that have a asp:Panel
control and the code that sets Visible = False
in it's code behind.
Now i want to change Visible = True
in one of content page. How do it?
Master page code behind:
AccountUserInfo.Visible = false;
Content page code behind:
((Panel)Master.FindControl("AccountUserInfo")).Visible = true;
Apparently content page's code behind don't work.
The master page code that set the control to Visible = False
is being executed after the code on the page.
Try to place the page code on the PreRender
event. It is the one of the last events of the cycle:
protected override void OnPreRender(EventArgs e)
{
((Panel)Master.FindControl("AccountUserInfo")).Visible = true;
base.OnPreRender(e);
}
Also, take a look at this ASP.NET Page Life Cycle Diagram