次の方法で共有


DataListDesigner.GetEmptyDesignTimeHtml メソッド

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

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

戻り値

デザイン時に空のテンプレート ベースのコントロールを表すために使用する HTML。

使用例

[Visual Basic] GetEmptyDesignTimeHtml メソッドをオーバーライドして、ユーザーが DataList.ItemTemplate プロパティを設定していない場合にデザイン画面にテキストを表示するコード例を次に示します。 TemplatedControlDesigner.CanEnterTemplateMode プロパティが true に設定されている場合は、デザイン画面でのテンプレートの編集方法について説明する文字列が表示されます。それ以外の場合は、HTML ビューでテンプレートを定義しなければならないことを伝える文字列が表示されます。

 
Overrides Protected Function GetEmptyDesignTimeHtml() As String
    Dim emptyText As String
 
    ' Check the CanEnterTemplateMode property to
    ' specify which text to display if the ItemTemplate
    ' does not contain a value. 
    If CanEnterTemplateMode Then
        emptyText = _
         "<b>Either the Enabled property value is false or you need to set the ItemTemplate for this control.<br>Right click and to edit templates.</b>"
    Else
        emptyText = _
         "<b>You cannot edit templates in this view.<br>Switch to HTML view to define the ItemTemplate.</b>"
    End If
    
    Return CreatePlaceHolderDesignTimeHtml(emptyText)
End Function

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

必要条件

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

.NET Framework セキュリティ:

参照

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