Hi All
I want to check my UltraGrid has error or not, and set e.Cancel accordingly. but I have no idea how to do this.
my form submit button calls form.validateChildren(), but i dont know where to set the e.Cancel.
i use objects as datasource, and my object class implemented IDataErrorInfo, and my UltraGrid is showing the error icon accordingly.
this is logically what i want
UltraGrid_validating(object sender, CancelEventArg e){
if(this.UltraGrid.hasError){
e.Cancel = true;
errorMessageList.Add( this.UltraGrid.ErrorMessage);
} else{e.Cancel = false;}
}
Regards
Bryan
Hi Bryan,
I'm not sure I understand exactly what you are trying to do. What are you trying to cancel?
If you click on a button on your form then the grid will lose focus and it will save any pending changes to the DataSource. If the DataSource support IDataErrorInfo, then the grid will display the errors at this point - after the DataSource has been updated.
So what part of this process are you trying to cancel? You cannot check for errors and then cancel the writing of the data to to the DataSource, since the errors don't occur until after the DataSource is updated.
Hi Mike,
Mike Saltzman"]If you click on a button on your form then the grid will lose focus and it will save any pending changes to the DataSource. If the DataSource support IDataErrorInfo, then the grid will display the errors at this point - after the DataSource has been updated.
Yes , the error icons do show on the grid. What the submit button do is re-validate the controls in the forms. Each control's validating event will be fire again, including the grid_validating event.
My problem is my ultrawingrid validation is done by the datasource's model's IDataErrorInfo members (i am using object data source), not the grid_validating event, hence, I need to check has the grid contain any error or not. How do I check has the grid contain any errors in the grid's validating event??
BR