I have a master page with one property name event type. Now I want to set this property from a content page and then that property value should be available to another conte
the easy way to get or set MasterPage's property, just like this.in content page do the follow.
protected override void Render(HtmlTextWriter writer)
{
var master = this.Master as Site;
master.SiteName += "|网站首页";
base.Render(writer);
}
and define property in master page
public partial class Site : System.Web.UI.MasterPage
{
public string MetaDescription { get; set; }
public string MetaKeywords { get; set; }
public string SiteName { get; set; }
public SiteSettings siteSettings { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
siteSettings = SettingsFactory.Get();
MetaDescription = siteSettings.SearchMetaDescription;
MetaKeywords = siteSettings.SearchMetaKeywords;
SiteName = siteSettings.SiteName;
}
}