Accessing Master Page Properties from a content page
As I mentioned in my previous blog post about Accessing a property of a base page from a user control, I am going to explain how to access a property on a MasterPage from the content page. One merely has to check the namespace and the class name of the masterpage, which can be found in the code behind file. Just cast the Content Page’s Master as the class of the masterpage file which it uses, and then just access the value. It is really quite simple.
int neededValue = ((MyNameSpace.MyMasterPageClassName)Master).MyProperty;
Using that method you are able to easily access a property of a masterpage file when needed.
Comment Notification
If you would like to receive an email when updates are made to this post, please register here
Subscribe to this post's comments using