LoginViewDesigner.GetEmptyDesignTimeHtml メソッド

定義

現在のテンプレートが定義されていない場合に、関連付けられているコントロールのプレースホルダーをデザイン時にレンダリングするマークアップを取得します。

protected:
 override System::String ^ GetEmptyDesignTimeHtml();
protected override string GetEmptyDesignTimeHtml();
override this.GetEmptyDesignTimeHtml : unit -> string
Protected Overrides Function GetEmptyDesignTimeHtml () As String

返品

デザイン サーフェイス上のプレースホルダーにレンダリングされるマークアップ テキストを含む文字列。

次のコード例は、GetEmptyDesignTimeHtml クラスから継承されたクラスのLoginViewDesigner メソッドをオーバーライドして、デザイン時にLoginView クラスから派生したコントロールの外観を変更する方法を示しています。 この例では、関連付けられたコントロールに対して定義されているすべての RoleGroup オブジェクトの名前を含むプレースホルダーのマークアップを生成します。

// Generate the design-time markup for the control 
// when the template is empty.
protected override string GetEmptyDesignTimeHtml()
{
    // Generate a design-time placeholder containing the names of all
    // the role groups.
    MyLoginView myLoginViewCtl = (MyLoginView)ViewControl;
    RoleGroupCollection roleGroups = myLoginViewCtl.RoleGroups;
    string roleNames = null;

    // If there are any role groups, form a string of their names.
    if (roleGroups.Count > 0)
    {
        roleNames = "Role Groups: <br />   " + 
            roleGroups[0].ToString();

        for( int rgX = 1; rgX < roleGroups.Count; rgX++ )
            roleNames += 
                "<br />   " + roleGroups[rgX].ToString();
    }
    return CreatePlaceHolderDesignTimeHtml( roleNames);
} // GetEmptyDesignTimeHtml
' Generate the design-time markup for the control 
' when the template is empty.
Protected Overrides Function GetEmptyDesignTimeHtml() As String

    ' Generate a design-time placeholder containing the names of all
    ' the role groups.
    Dim myLoginViewCtl As MyLoginView = CType(ViewControl, MyLoginView)
    Dim roleGroups As RoleGroupCollection = myLoginViewCtl.RoleGroups
    Dim RoleNames As String = Nothing
    Dim rgX As Integer

    ' If there are any role groups, form a string of their names.
    If roleGroups.Count > 0 Then

        roleNames = "Role Groups: <br />   " & _
            roleGroups(0).ToString()

        For rgX = 1 To roleGroups.Count - 1
            roleNames &= "<br />   " & _
                roleGroups(rgX).ToString()
        Next rgX
    End If

    Return CreatePlaceHolderDesignTimeHtml(roleNames)

End Function ' GetEmptyDesignTimeHtml

注釈

GetEmptyDesignTimeHtml メソッドは、まず、関連付けられているLoginView コントロールの現在のテンプレートの名前を指定し、テンプレートが空であることを指定する文字列メッセージを書式設定します。 その後、 GetEmptyDesignTimeHtml は、そのメッセージを含むプレースホルダーのマークアップを生成します。

適用対象

こちらもご覧ください