Brendan Enrick's Blog

Daily Software Development.


Accessing Master Page Properties from a content page

by Brendan Enrick Thursday, June 21 2007 18:05

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.

Tagged as:

Comments

7/30/2010 10:18:17 AM #

trackback

Accessing Properties of a Base Page from a User Control

Accessing Properties of a Base Page from a User Control

Brendan Enrick

Comments are closed