Assume in the master page, we have a user control which we need to access and set its visiblity from content page. We create a public property in the master page called controlVisiblity
public bool LoginControlVisible
LoginControl.Visible = value;
To gain access to the master page file from the content page, you just need to add the below directive to the content page
<%@ MasterType VirtualPath=”~/siteMaster.master”%>
When ASP.NET realizes the existance of this directive, it generates a strongly typed property “Master”. this property will give you access to the MasterPage file. So directly in the content page code behind you would use the below instead of trying to use the FindControl method.
Master.LoginControlVisible = true;
Master.LoginControlVisible = false;