我在一个用户控件里面放了一个PlaceHolder,在这个用户控件里面我定义了一个方法AddControl,用来往这个PlaceHolder中加控件。如果动态加入的这个控件中没有UpdatePanel,页面可以正常运行,但是如果动态加入的控件中有UpdatePanel,则会报错Cannot unregister UpdatePanel with ID XXX since it was not registered with the ScriptManager.This might occur if the UpdatePanel was removed from the control tree and latter added again。请问大家有没有办法解决。非常感谢~
但由于动态加入,在页面无有得到注册,估计是不能用的.
[TemplateContainer(typeof(MyTemplateContainer))]
[PersistenceMode(PersistenceMode.InnerProperty)]
public ITemplate MyContentTemplate
{
get { return _myContentTemplate; }
set { _myContentTemplate = value; }
}
这个自定义控件确实有了一个自定的模板属性MyContentTemplate,但是一旦从源切换到设计就会报错:说webusercontrol不具有MyContentTemplate的属性后来我就用PlaceHolder动态增加congrol的方法来代替了