We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to reset the default value when validate data

Hi, In DataBoundGrid, I use ValidateFailed to validate a numeric column as below: private void dgrSelectedFields_ValidateFailed(object sender, Syncfusion.Windows.Forms.Grid.GridValidateFailedEventArgs e) { GridCurrentCell cc = this.dgrSelectedFields.CurrentCell; int row = cc.RowIndex; int col = cc.ColIndex; string strValue = dgrSelectedFields[row, col].Text; string strMessage = "Item ''" + strValue + "'' does not pass validation test."; cc.ErrorMessage = ""; MessageBox.Show(strMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Handled = false; } Could you please tell me how to reset the default value of the cell after the MessageBox shown? Because the default value will only be reset when user press ESC key. Thanks

2 Replies

AD Administrator Syncfusion Team May 11, 2005 03:37 PM

Try setting dgrSelectedFields[row, col].Text = defaultValue; dgrSelectedFields.RefreshRange(GridRangeInfo.Cell(row, col), true);


AD Administrator Syncfusion Team May 11, 2005 10:28 PM

Thanks for your reply. >Try setting > >dgrSelectedFields[row, col].Text = defaultValue; >dgrSelectedFields.RefreshRange(GridRangeInfo.Cell(row, col), true); >

Loader.
Live Chat Icon For mobile
Up arrow icon