ControlBuilder.AppendSubBuilder(ControlBuilder) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将生成器添加到属于容器控件的任何子控件的 ControlBuilder 对象。
public:
virtual void AppendSubBuilder(System::Web::UI::ControlBuilder ^ subBuilder);
public virtual void AppendSubBuilder (System.Web.UI.ControlBuilder subBuilder);
abstract member AppendSubBuilder : System.Web.UI.ControlBuilder -> unit
override this.AppendSubBuilder : System.Web.UI.ControlBuilder -> unit
Public Overridable Sub AppendSubBuilder (subBuilder As ControlBuilder)
参数
- subBuilder
- ControlBuilder
分配给子控件的对象 ControlBuilder。
示例
以下示例重写此方法AppendSubBuilder,以引发此控件生成器尝试在其类实例ControlCollection中包含控件时引发Exception该控件。
// Override the AppendSubBuilder method to throw an
// exception if the class it is applied to attempts
// to include child controls.
public override void AppendSubBuilder(ControlBuilder subBuilder)
{
throw new Exception(
"A custom label control cannot contain other objects.");
}
' Override the AppendSubBuilder method to throw an
' exception if the class it is applied to attempts
' to include child controls.
Public Overrides Sub AppendSubBuilder(ByVal subBuilder As ControlBuilder)
Throw New Exception( _
"A custom label control cannot contain other objects.")
End Sub