Share via


ControlParser.ParseControl メソッド

定義

指定したマークアップからコントロールを作成します。

オーバーロード

ParseControl(IDesignerHost, String)

指定したデザイナー ホストを使用して、指定したマークアップからコントロールを作成します。

ParseControl(IDesignerHost, String, String)

指定したデザイナー ホストとディレクティブを使用して、指定したマークアップからコントロールを作成します。

ParseControl(IDesignerHost, String)

指定したデザイナー ホストを使用して、指定したマークアップからコントロールを作成します。

public:
 static System::Web::UI::Control ^ ParseControl(System::ComponentModel::Design::IDesignerHost ^ designerHost, System::String ^ controlText);
public static System.Web.UI.Control ParseControl (System.ComponentModel.Design.IDesignerHost designerHost, string controlText);
static member ParseControl : System.ComponentModel.Design.IDesignerHost * string -> System.Web.UI.Control
Public Shared Function ParseControl (designerHost As IDesignerHost, controlText As String) As Control

パラメーター

designerHost
IDesignerHost

ページのデザイナー ホストである IDesignerHost インスタンス。

controlText
String

コントロールの HTML マークアップ。

戻り値

controlText が表す Control。パーサーがコントロールを作成できなかった場合は null

例外

パラメーターが無効です。

次のコード例は、HTML マークアップ テキストからコントロールを作成する方法を示しています。 このコード例は、ControlParser クラスのために提供されている大規模な例の一部です。

// Create a Web control from the persisted control String*.
System::Web::UI::Control^ ctrl = ControlParser::ParseControl( host, inputForm->tbox->Text->Trim() );
// Create a Web control from the HTML markup.
System.Web.UI.Control ctrl =
    ControlParser.ParseControl(host, inputForm.TBox.Text.Trim());
' Create a Web control from the persisted control string.
Dim ctrl As System.Web.UI.Control = ControlParser.ParseControl(host, inputForm.TxBox.Text.Trim())

注釈

メソッドは ParseControl 、デザイナー ホストのサービスを使用して、ASP.NET Web ページの register ディレクティブを表す文字列にアクセスします。 デザイナー ホスト サービスは、 オブジェクトの プロパティをReferenceManagerRootDesigner通じて取得されます。使用できない場合は、サービスがIWebFormReferenceManager取得されます。

パーサーがコントロールをビルドできない場合、メソッドは ParseControl 例外をスローします。

こちらもご覧ください

適用対象

ParseControl(IDesignerHost, String, String)

指定したデザイナー ホストとディレクティブを使用して、指定したマークアップからコントロールを作成します。

public:
 static System::Web::UI::Control ^ ParseControl(System::ComponentModel::Design::IDesignerHost ^ designerHost, System::String ^ controlText, System::String ^ directives);
public static System.Web.UI.Control ParseControl (System.ComponentModel.Design.IDesignerHost designerHost, string controlText, string directives);
static member ParseControl : System.ComponentModel.Design.IDesignerHost * string * string -> System.Web.UI.Control
Public Shared Function ParseControl (designerHost As IDesignerHost, controlText As String, directives As String) As Control

パラメーター

designerHost
IDesignerHost

ページのデザイナー ホストである IDesignerHost インスタンス。

controlText
String

コントロールの HTML マークアップのテキスト。

directives
String

コントロールのコードに含めるページ ディレクティブ。

戻り値

controlText が表す Control

例外

パラメーターが無効です。

次のコード例は、HTML マークアップ テキストからコントロールを作成する方法を示しています。 このコード例は、ControlParser クラスのために提供されている大規模な例の一部です。

// Create a Web control from the persisted control String*.
System::Web::UI::Control^ ctrl = ControlParser::ParseControl( host, inputForm->tbox->Text->Trim() );
// Create a Web control from the HTML markup.
System.Web.UI.Control ctrl =
    ControlParser.ParseControl(host, inputForm.TBox.Text.Trim());
' Create a Web control from the persisted control string.
Dim ctrl As System.Web.UI.Control = ControlParser.ParseControl(host, inputForm.TxBox.Text.Trim())

注釈

メソッドは ParseControl 、デザイナー ホストのサービスを使用して、ASP.NET Web ページの register ディレクティブを表す文字列にアクセスします。 デザイナー ホスト サービスは、 オブジェクトの プロパティをReferenceManagerRootDesigner通じて取得されます。使用できない場合は、サービスがIWebFormReferenceManager取得されます。

パーサーがコントロールをビルドできない場合、メソッドは ParseControl 例外をスローします。

こちらもご覧ください

適用対象