48 lines
1.1 KiB
C#
48 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
|
|
namespace TeamLab.Controls
|
|
{
|
|
|
|
[ParseChildren(false), PersistChildren(false)]
|
|
public class LocalizeContent : TemplateControl
|
|
{
|
|
private BasePage basePage;
|
|
public string ControlName { get; set; }
|
|
Control ctrl = null;
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
if (ctrl is BaseContentUserControls)
|
|
{
|
|
(ctrl as BaseContentUserControls).UpdatePage();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
protected override void OnInit(EventArgs e)
|
|
{
|
|
base.OnInit(e);
|
|
basePage = Page as BasePage;
|
|
|
|
if (string.IsNullOrEmpty(ControlName))
|
|
{
|
|
return;
|
|
}
|
|
|
|
string controlFileName = basePage.GetContentFileName(ControlName);
|
|
|
|
if(!string.IsNullOrEmpty(controlFileName))
|
|
{
|
|
Controls.Clear();
|
|
ctrl = this.LoadControl(controlFileName);
|
|
Controls.Add(ctrl);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|