Service constraints (with session) - Demonstration

Every time you provide a value, it must be higher than before. The previous value is stored in session.

 
Some Branch
Must Be More
XML output

        
Service constraints (with session) - Description

The true potential of the ServiceConstraint control is unraveled, when it is used with session. This allows the user to dynamically validate the form content with the data that is session-specific. The following example shows such a use in a very simple example.

In the AutoComplete webservice class, a simple method MustBeGreaterThanBefore has been written. The method is provided with [WebMethod(true)] custom attribute, which enables the web session. The method compares the value from the form with the value from session.

The Leaf MustBeMore is provided with a service constraint that invokes the MustBeGreaterThanBefore method with a parameter of value from itself (the attribute Path of value . denotes self).

Finally, after the click on the NextPageButton, the value aquired from the MustBeMore leaf is written to the session.

This way, after each PostBack, to make the value of MustBeMore leaf valid, it has to be higher than before.

This page is hosted free, courtesy of GoDaddy.com®
Copyright © 2009 GoDaddy.com, Inc. All Rights Reserved.
Domain names from $1.99
Visit GoDaddy.com for the best values on: Domain names, Web hosting and more! See product catalog.