ServerValidateEventArgs Class

Provides data for the ServerValidate event of the CustomValidator control. This class cannot be inherited.


Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public ref class ServerValidateEventArgs : public EventArgs

The ServerValidateEventArgs type exposes the following members.

Public methodServerValidateEventArgsInitializes a new instance of the ServerValidateEventArgs class.

Public propertyIsValidGets or sets whether the value specified by the Value property passed validation.
Public propertyValueGets the value to validate in the custom event handler for the ServerValidate event.

Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

A ServerValidateEventArgs is passed to the ServerValidate event handler to provide event data to the handler. The ServerValidate event is raised when validation is performed on the server. This allows you to perform a custom server-side validation routine on the value of an input control (with a CustomValidator control associated with it) in the event handler.

The value to validate is determined by using the Value property. Once your code has determined whether the value is valid, store the results of the validation in the IsValid property.

For a list of initial property values for an instance of ServerValidateEventArgs, see the ServerValidateEventArgs constructor.

For more information about handling events, see Consuming Events.

Walkthrough: Validating User Input in a Web Forms PageBuilding ASP .NET Web Applications in Visual Studio

The following example demonstrates how to use a ServerValidateEventArgs to pass event data to a custom event handler for the ServerValidate event. Notice that the Value property of the ServerValidateEventArgs is used to determine the value to validate, while the IsValid property is used to store the results of the validation.

No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft