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.