Bewerken

Delen via


ValidatingPropertiesEventArgs Class

Definition

Provides data for the ValidatingProperties event.

public ref class ValidatingPropertiesEventArgs : EventArgs
public class ValidatingPropertiesEventArgs : EventArgs
type ValidatingPropertiesEventArgs = class
    inherit EventArgs
Public Class ValidatingPropertiesEventArgs
Inherits EventArgs
Inheritance
ValidatingPropertiesEventArgs

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.

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

Remarks

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.

Properties

FailedProperties

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

Properties

Gets the collection of names and values of the profile properties to validate.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to