ValidatingPropertiesEventArgs.Properties Vlastnost

Definice

Získá kolekci názvů a hodnot vlastností profilu k ověření.

public:
 property System::Collections::Generic::IDictionary<System::String ^, System::Object ^> ^ Properties { System::Collections::Generic::IDictionary<System::String ^, System::Object ^> ^ get(); };
public System.Collections.Generic.IDictionary<string,object> Properties { get; }
member this.Properties : System.Collections.Generic.IDictionary<string, obj>
Public ReadOnly Property Properties As IDictionary(Of String, Object)

Hodnota vlastnosti

Názvy a hodnoty vlastností profilu, které se mají ověřit.

Příklady

Následující příklad ukazuje obslužnou rutinu ValidatingProperties události pro událost. Pokud je hodnota předaná vlastnosti FirstName prázdná nebo null, FirstName vlastnost se přidá do FailedProperties kolekce.

void Application_Start(object sender, EventArgs e) 
{
    System.Web.ApplicationServices.ProfileService.ValidatingProperties += new EventHandler<System.Web.ApplicationServices.ValidatingPropertiesEventArgs>(ProfileService_ValidatingProperties);
}

void ProfileService_ValidatingProperties(object sender, System.Web.ApplicationServices.ValidatingPropertiesEventArgs e)
{
    if (String.IsNullOrEmpty((string)e.Properties["FirstName"]))
    {
        e.FailedProperties.Add("FirstName");
    }
}
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
    AddHandler System.Web.ApplicationServices.ProfileService.ValidatingProperties, _
      AddressOf ProfileService_ValidatingProperties
End Sub

Sub ProfileService_ValidatingProperties(ByVal sender As Object, ByVal e As System.Web.ApplicationServices.ValidatingPropertiesEventArgs)
    If (String.IsNullOrEmpty(CType(e.Properties("FirstName"), String))) Then
        e.FailedProperties.Add("FirstName")
    End If
End Sub

Poznámky

Vlastnost Properties vrátí IDictionary objekt, který obsahuje názvy a hodnoty vlastností profilu, které se mají nastavit pro uživatele. Pokud pro událost vytvoříte obslužnou rutinu ValidatingProperties události, můžete z Properties vlastnosti načíst vlastnosti, které se mají ověřit. Pokud se ověření některé hodnoty nezdaří, přidejte je do FailedProperties vlastnosti . Metoda SetPropertiesForCurrentUser vrátí kolekci ve FailedProperties vlastnosti , abyste mohli určit, které vlastnosti se nepodařilo ověřit.

Platí pro