Aracılığıyla paylaş


LoginViewDesigner.GetEmptyDesignTimeHtml Yöntem

Tanım

Geçerli şablon tanımlanmadığında tasarım zamanında ilişkili denetim için yer tutucu oluşturan işaretlemeyi alır.

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

Döndürülenler

String

Tasarım yüzeyinde bir yer tutucuya işlenen işaretleme metni içeren bir dize.

Örnekler

Aşağıdaki kod örneği, tasarım zamanında sınıfından GetEmptyDesignTimeHtml türetilen LoginViewDesigner bir denetimin görünümünü değiştirmek için sınıfından LoginView devralınan bir sınıfta yönteminin nasıl geçersiz kılındığını gösterir. Örnek, ilişkili denetim için tanımlanan tüm RoleGroup nesnelerin adlarını içeren bir yer tutucu için işaretleme oluşturur.

// 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

Açıklamalar

GetEmptyDesignTimeHtml yöntemi önce ilişkili LoginView denetimin geçerli şablonunun adını belirten ve ayrıca şablonun boş olduğunu belirten bir dize iletisi biçimlendirmektedir. Ardından, GetEmptyDesignTimeHtml bu iletiyi içeren bir yer tutucu için işaretlemeyi oluşturur.

Şunlara uygulanır

Ayrıca bkz.