I am experimenting with server side validation of ListGrid data and the behavior I observe is:
1/ Whenever a field is changed and the change is submitted to the grid, the grid sends unconditionally to the server 2 requests: one for validation and then one for update.
2/ On the server my custom validator is called by SQLDataSource 2 times - once during execution of the validation request and once during execution of the update request.
3/ On the first call to the validator it gets (in the "record" parameter) data which is a merge of the changed values and the old valies in the request.
4/ On the second call to the validator it gets only the primary key and the new values.
5/ Whenever a new record is submitted to the grid it issues as many validation requests to the server as is the number of fields with attached server side validators followed by a create request.
The problems I have with all this are:
1/ Why the grid issues upon data change a validation request if it is unconditionally followed by an update request which triggers validation too?
2/ Why are the validation requests upon record creation so many and why are they issued at all if the unconditionally following create operation triggers validation too?
2/ Why is it that during an update operation the (SQL) data source does not merge changed and old values prior to calling the validator(s)?
3/ Is there a way to get hold of the old values from the request in my custom validator? I looked at all required and optional arguments and found so far no way that would make sense.
The reason why old data matters much to me is that I want to be able to do validation based on relations between feelds (e.g. - comparison) rather than individual values only. At present I am forced to pull old data from the database which is doable but much more expensive than getting the old data from the request.
Can somebody please answer the questions above?
1/ Whenever a field is changed and the change is submitted to the grid, the grid sends unconditionally to the server 2 requests: one for validation and then one for update.
2/ On the server my custom validator is called by SQLDataSource 2 times - once during execution of the validation request and once during execution of the update request.
3/ On the first call to the validator it gets (in the "record" parameter) data which is a merge of the changed values and the old valies in the request.
4/ On the second call to the validator it gets only the primary key and the new values.
5/ Whenever a new record is submitted to the grid it issues as many validation requests to the server as is the number of fields with attached server side validators followed by a create request.
The problems I have with all this are:
1/ Why the grid issues upon data change a validation request if it is unconditionally followed by an update request which triggers validation too?
2/ Why are the validation requests upon record creation so many and why are they issued at all if the unconditionally following create operation triggers validation too?
2/ Why is it that during an update operation the (SQL) data source does not merge changed and old values prior to calling the validator(s)?
3/ Is there a way to get hold of the old values from the request in my custom validator? I looked at all required and optional arguments and found so far no way that would make sense.
The reason why old data matters much to me is that I want to be able to do validation based on relations between feelds (e.g. - comparison) rather than individual values only. At present I am forced to pull old data from the database which is doable but much more expensive than getting the old data from the request.
Can somebody please answer the questions above?
Comment