This example demonstrates RadInputManager's capability to validate the controls
it extends through a web service. In this particular scenario, detailed order information
can be added or changed only if the specified quantity is not greater than the units
in stock of the corresponding product.
In order to use RadInputManager's validation-through-a-web-service feature, you
- define a WebService class and apply to it the ScriptServiceAttribute;
- implement a WebMethod that accepts two or three parameters and returns a bool value,
indicating whether the validation has passed or failed:
- the first parameter to the method must be a string object and contains the id of
the control being validated;
- the second parameter also needs to be a string object and holds the value of the
control being validated;
- the third parameter is optional and of type object - it is used to transfer
to the validation method any additional information that might be needed for the
validation logic. This parameter can be set in the event arguments object passed
to the OnValidating event which is raised both on the client and on the server
before the web service validation method has been called.
- specify the path to the WebService through the corresponding RadInputManager setting's
Location property and the validation method through the Method property;
- indicate the event on which validation should be performed through the corresponding
RadInputManager setting's ValidateOnEvent property.
By analogy to the MS ASP.NET CustomValidator control RadInputManager performs validation
both on the client and on the server with the server-side validation being executed
in the browser.
In this example the validation condition on the client is the same as the one on
the server but in other real-world scenarios there might be cases when the validation
logic on the client may differ from that on the server.
The following example demonstrates RadInputManager's validation through a web service.
Detailed order information can be added or changed only if the specified quantity
is not greater than the units in stock of the corresponding product.