ControlBuilder.AppendSubBuilder(ControlBuilder) 方法

定义

将生成器添加到属于容器控件的任何子控件的 ControlBuilder 对象。Adds builders to the ControlBuilder object for any child controls that belong to the container control.

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

分配给子控件的对象 ControlBuilderThe ControlBuilder object assigned to the child control.

示例

下面的示例重写 AppendSubBuilder 方法,以便在此控件生成器应用于的控件尝试在其 ControlCollection 类的实例中包含控件时引发 ExceptionThe following example overrides the AppendSubBuilder method to throw an Exception if the control this control builder is applied to tries to include controls in its instance of ControlCollection class.

// 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

适用于

另请参阅