次の方法で共有


ControlDesigner.GetEmptyDesignTimeHtml メソッド

デザイン時に空のコントロールを表すために使用する HTML を取得します。

Protected Overridable Function GetEmptyDesignTimeHtml() As String
[C#]
protected virtual string GetEmptyDesignTimeHtml();
[C++]
protected: virtual String* GetEmptyDesignTimeHtml();
[JScript]
protected function GetEmptyDesignTimeHtml() : String;

戻り値

デザイン時に空のコントロールを表すために使用する HTML。既定では、この HTML にはコンポーネント名が格納されます。

解説

このメソッドの既定の動作では、コンポーネント名を含んでいる文字列を返します。このメソッドは、デザイン時 HTML がないときに、 GetDesignTimeHtml によって呼び出されます。

使用例

[Visual Basic] テンプレート宣言されたコントロール デザイナの GetEmptyDesignTimeHtml メソッドをオーバーライドするコード例を次に示します。このコードは、 TemplatedControlDesigner.CanEnterTemplateMode プロパティの値を調べ、その結果に応じて、文字列変数に設定する値を 2 つの選択肢から選びます。結果として得られる文字列は、 CreatePlaceHolderDesignTimeHtml メソッドの呼び出し時に instruction パラメータに渡されます。

 
' Override the GetEmptyDesignTimeHtml to check whether 
' template mode can be used from the designer, and provide
' display messages for both cases.      
Protected Overrides Function GetEmptyDesignTimeHtml() As String
   Dim textValue As String
   
   If CanEnterTemplateMode Then
      textValue = "Right click and choose a set of templates to edit their content.<br>The ItemTemplate is required."
   Else
      textValue = "Switch to HTML view to edit the control's templates.<br>The ItemTemplate is required."
   End If
   Return CreatePlaceHolderDesignTimeHtml(textValue)
End Function

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

必要条件

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

.NET Framework セキュリティ:

参照

ControlDesigner クラス | ControlDesigner メンバ | System.Web.UI.Design 名前空間