---
title: "Set Property Value on Master Page from Content Page"  
description: "In this blog I am going to explain how to set value of property on the master page, so that property can be easily access on its content page.  If you"  
author: "Chris Anderson"  
published: 2011-10-17  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/258/set-property-value-on-master-page-from-content-page  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# Set Property Value on Master Page from Content Page

In this blog I am going to [explain](https://www.mindstick.com/forum/157854/what-is-system-debugging-explain-some-system-debugging-tools-used-in-modern-computer-systems) how to set value of [property](https://www.mindstick.com/blog/205/property-notification-in-c-sharp) on the [master page](https://www.mindstick.com/forum/389/how-to-add-master-page-in-php), so that property can be easily [access](https://www.mindstick.com/articles/12994/how-foreigners-can-access-blocked-websites-in-china) on its [content](https://www.mindstick.com/articles/13019/get-the-best-content-marketing-pricing-packages-for-your-brand) page.\

If you need to [pass data](https://www.mindstick.com/forum/351/how-to-pass-data-from-controller-to-ascx-page) to a [variable](https://www.mindstick.com/articles/1807/objective-c-data-types-variables-object-creation) from content page to master page

you have to create a property in master page.\
\
Create a property in your master page:

protected static string _master = "home";

```
public string Section{
   get   {      return _master;
   }
   set   {       _master = value;
   }
}
```

After creating a property in a master page you have to add a directive in

the child or content page.

##### Add page directive to your content page:

```
<%@ MasterType VirtualPath="~/MasterPage.master" %>
```

After creating a property in the master page and adding a directive in the

content page, now you can easily access the property in all the child pages

which inherit master [page directive](https://www.mindstick.com/interview/999/explain-the-use-of-duration-attribute-of-outputcache-page-directive).

##### You can access this property like this:

##### Master.Section = "hello";

---

Original Source: https://www.mindstick.com/blog/258/set-property-value-on-master-page-from-content-page

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
