helpcenter/Web/App_Code/BaseContentUserControls.cs

47 lines
1.3 KiB
C#
Raw Normal View History

2016-08-29 13:51:20 +00:00
using System;
using System.Web.UI;
public class BaseContentUserControls : UserControl
{
public string PageCaption { get; set; }
public string PageTitle { get; set; }
public string MetaDescription { get; set; }
public string MetaKeyWords { get; set; }
protected new virtual void Init() { }
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
PageCaption = PageTitle = string.Empty;
2016-08-29 13:51:20 +00:00
Init();
}
public void UpdatePage()
{
if(Page is BasePage)
{
BasePage bp = Page as BasePage;
if(!string.IsNullOrEmpty(PageCaption) && string.IsNullOrEmpty(bp.PageCaption))
{
bp.PageCaption = PageCaption;
}
if (!string.IsNullOrEmpty(PageTitle) && string.IsNullOrEmpty(bp.PageTitle))
{
bp.PageTitle = PageTitle;
}
if (!string.IsNullOrEmpty(MetaDescription)&& string.IsNullOrEmpty(bp.MetaDescription))
{
bp.MetaDescription = MetaDescription;
}
if (!string.IsNullOrEmpty(MetaKeyWords) && string.IsNullOrEmpty(bp.MetaKeyWords))
{
bp.MetaKeyWords = MetaKeyWords;
}
}
}
}