【发布时间】:2011-04-09 21:19:59
【问题描述】:
我正在扩展 Tellerick RadGrid 控件,为其提供一个可选的 CustomSearchControl。
protected override void CreateChildControls()
{
this.Controls.Add(CustomSearchControl);
base.CreateChildControls();
this.Controls.Add(CustomSearchControl);
}
似乎 base.CreateChildControls() 必须有一个明确的控件调用,因为第一个 CustomSearchControl 消失了。
我尝试了这个:
protected override void CreateChildControls()
{
base.CreateChildControls();
this.Controls.AddAt(0,CustomSearchControl);
this.Controls.Add(CustomSearchControl);
}
但是它会创建一个视图状态错误...因为两个控件都没有添加到视图状态中,并且插入破坏了控件集合的层次结构。
【问题讨论】:
标签: c# radgrid createchildcontrols