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