I have an ASP.NET page that uses a MasterPage. I have a public bool attribute in the MasterPage called ShowChangePassword. I want to set this to true or false in the page that uses this MasterPage.
I have the following code, but I can’t set the attribute:
var masterPage = this.Master;
masterPage.ShowChangePassword = false;
What code do I need to do this?
You need a typed reference to your master page class. Put something like that in your content page:
Then you can do: