次の方法で共有


ControlParser.ParseControl メソッド (IDesignerHost, String, String)

指定したデザイナ ホストとディレクティブを使用して、指定した永続化制御コードからコントロールを作成します。

Overloads Public Shared Function ParseControl( _
   ByVal designerHost As IDesignerHost, _   ByVal controlText As String, _   ByVal directives As String _) As Control
[C#]
public static Control ParseControl(IDesignerHostdesignerHost,stringcontrolText,stringdirectives);
[C++]
public: static Control* ParseControl(IDesignerHost* designerHost,String* controlText,String* directives);
[JScript]
public static function ParseControl(
   designerHost : IDesignerHost,controlText : String,directives : String) : Control;

パラメータ

  • designerHost
    ドキュメントのデザイナ ホストである IDesignerHost
  • controlText
    コントロールのコードのテキスト。
  • directives
    コントロールのコードに含めるディレクティブ。

戻り値

指定したテキストが表す Control

例外

例外の種類 条件
ArgumentNullException パラメータが無効です。

解説

このメソッドは、デザイナ ホストをとおして取得した IWebFormReferenceManager サービスを使用して、Web フォーム ドキュメントのレジスタ ディレクティブを表す文字列にアクセスします。

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

使用例

 
' Create a Web control from the persisted control string.
Dim ctrl As System.Web.UI.Control = ControlParser.ParseControl(host, inputForm.tbox.Text.Trim())

[C#] 
// Create a Web control from the persisted control string.
System.Web.UI.Control ctrl = 
    ControlParser.ParseControl(host, inputForm.tbox.Text.Trim());

[C++] 
// Create a Web control from the persisted control String*.
System::Web::UI::Control* ctrl =
   ControlParser::ParseControl(host, inputForm->tbox->Text->Trim());

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ

.NET Framework セキュリティ:

参照

ControlParser クラス | ControlParser メンバ | System.Web.UI.Design 名前空間 | ControlParser.ParseControl オーバーロードの一覧