47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
|
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;
|
|||
|
|
|||
|
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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|