Web form validation vs object validation

  • Thread starter Thread starter Colin Basterfield
  • Start date Start date
C

Colin Basterfield

Hi,

I have a web form which takes daily sales totals, both counts and monetary
value and is done on a weekly basis, so on a Monday morning the User would
enter these totals. Each total has a range, which at the lower end is >= 0
and the upper limit is configurable, these totals are then submitted to a
web service which posts them to a data store.

The question is regarding validation, obviously I can validate on the web
form using RangeValidator, and I was thinking of using an event to track
which control had focus and then modify the ControlToValidate accordingly.
So my first question would be how do you track on a web form which control
has focus using an event?

However perhaps a broader question would be: surely it would be better to
simply submit the whole object which holds the totals, and return any error
message, to the erring control, however that gets complicated if there is
more than one error, this would involve the whole object to-ing and fro-ing
between the web service and the web form?

Any thoughts anyone?
Many thanks
Colin
 
1. You just create a RangeValidator for each control you want to
validate on
your webform. Why do you want to share one RangeValidator control?

2. There is a validation summary control that will display all error
messages
of all the validation control on the client side.

Could you explain your process flow further in detail? It seems that
you could just do #1 and #2, and if it is successful, then your
webform that submit the the data to the web service.

Tommy,
 
Back
Top