Custom constraints - Demonstration

Provide an even value (check out the EvenOnlyValidate server side method and EvenOnly javascript function)

 
Custom Constraint Example
Even Only
Even Only Server Only Validation
XML output

        
Custom constraints - Description

The custom constraint is a constraint that allows defining custom client and server-side validation

To check the constraint on the client side a ClientFunctionName property should be set.

If it is not set, there will be no client-side validation

The implementation of function should look like this:
function clientFunctionName (value, client_id)

To check the function on the server side, the OnServerValidate event should be implemented. If it is not implemented, the validation will by default return true on server side.

The CustomConstraint may closely resemble the ASP.NET CustomValidator control. You should however notice that the function definition is different