ValidatingPropertiesEventArgs.FailedProperties Property

Definition

Gets the collection that contains profile properties that have failed validation.

C#
public System.Collections.ObjectModel.Collection<string> FailedProperties { get; }

Property Value

The profile properties that have failed validation.

Examples

The following example shows an event handler for the ValidatingProperties event. When the value passed for FirstName property is empty or null, the FirstName property is added to the FailedProperties collection.

C#
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");
    }
}

Remarks

The FailedProperties property contains a collection of the names of the properties that have failed validation. If you create an event handler for the ValidatingProperties event, you add the names of the properties that fail validation to the collection in the FailedProperties property. The SetPropertiesForCurrentUser method returns the collection in the FailedProperties property so that you can determine which properties failed validation.

Applies to

Produkt Verzie
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1