This topic has not yet been rated - Rate this topic

ValidatingPropertiesEventArgs Class

Provides data for the ValidatingProperties event.

Namespace:  System.Web.ApplicationServices
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class ValidatingPropertiesEventArgs : EventArgs

You create an event handler for the ValidatingProperties event to customize how profile property values are validated. The ValidatingProperties event is raised when profile properties are set for a user. If any property values fail validation, add them 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.

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.

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");
    }
}
System.Object
  System.EventArgs
    System.Web.ApplicationServices.ValidatingPropertiesEventArgs
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.