Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
425
Object source + IDataErrorInfo + Form's validateChildren
posted

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

Parents
  • 469350
    Offline posted

    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.

     

Reply Children