Easiest way is to setup a property on your master page that handles the on/off functionality when called. Then in your child page set the MasterType directive to get a strongly typed reference to your master page to bypass the need to cast.
Your child page would have:
<%@ MasterType VirtualPath="~/Site1.Master" %>
And to call the property of the master page:
Master.MyLabel = false; // or true
So on your master you could have:
public bool MyLabel
{
get
{
return masterLabel.Enabled;
}
set
{
masterLabel.Enabled = value;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…