的OnPreRender事件改写我试图使用部分类在部分类
第一类是从Kentico CMS重写的OnPreRender事件,我不能改变的类,因为它是在CMS默认类。现在我想在第一个类中重写OnPreRender事件的默认行为,这是我手动创建的一个自定义类的第二个类。
1级
using System;
using System.Collections.Generic;
using CMS.UIControls;
using CMS.ExtendedControls;
using CMS.PortalEngine;
using CMS.Helpers;
public partial class CMSPages_PortalTemplate : PortalPage
{
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
// Init the header tags
//tags is a label
tags.Text = HeaderTags;
if (PortalContext.ViewMode.IsWireframe())
{
CSSHelper.RegisterWireframesMode(this);
}
}
}
2级
using CMS.UIControls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
public partial class CMSPages_PortalTemplate : PortalPage
{
public CMSPages_PortalTemplate()
{
}
protected override void OnPreRender(EventArgs e)
{
//Override behavior
tags.Text = tags.Text + HeaderTags + "MyTest";
}
}
这可能吗?我尝试过调试,但它从未打过第二类的OnPreRender事件