Global properties defined on Masterpage

Hello everyone, Is it possible to define episerver properties on the Masterpage and in set the properties in to dynamic in EPiServer? I want to declare a property to a page as a dynamic property and define the property on the masterpage so I can access the url from all pages in the site. The following example illustrates what I want to. The code shows relevant parts of the masterpage and code-behind to masterpage as well as a aspx page with codebehind of course the GlobalProperty is a dynamic property and GetUrlFromProperty is a function that gets the url from a page property that I have defined. Masterpage (masterpage) ---------- <%@ master language="C#" autoeventwireup="true" codebehind="MyFramework.master.cs" inherits="Templates.MasterPages.MyFramework" %> Masterpage (masterpage.cs) -------------------------- // Global property private string globalProperty; public string GlobalProperty { get { if (globalProperty == null) { globalProperty = EPiController.GetUrlFromProperty(EPiGlobalProperty, ((TemplatePage)Page).Configuration); } return globalProperty ; } } ASPX ---- <%@ page language="C#" masterpagefile="~/templates/MasterPages/MyFramework.Master" autoeventwireup="true" codebehind="MyPage.aspx.cs" inherits="MyPage" title="Untitled Page" %> <%@ mastertype virtualpath="~/templates/MasterPages/MyFramework.Master" %> ASPX.cs ------- protected void Page_Load(object sender, EventArgs e) { // This will not work since the global property will not have a value specified string globalUrl = Master.GlobalProperty; }
Jan 23, 2008 13:02
I have read your post 5 times now, and I think I might be missing the point. Why do you want to put this in the master file? Do you have more than one master file, where the functionality of your GlobalProperty is different? As this is an EPiServer Dynamic Property in the first case, you can access the dynamic property if you have the PageData (which you will have on your template.) /Steve
Jan 24, 2008 15:27
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.