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

Cell value can not be validated automatically

Hi there,

I have a Gridcontrol contains several columns, which has different value types.

The problem is, when I insert a wrong type of value into a cell, for example a string into a integer type cell, instead of poping up a window tells me the foramt is wrong, the program catches FormatException.

I dont know if there is any way to set the Gridcontrol to be able to automatically validate the value and shows the pop up window

Thanks in anticipation

Kun

4 Replies

BC Babu Chella Velu Syncfusion Team January 5, 2007 03:27 AM UTC

Hi Kun,

You can handle the CurrentCellErrorMessage event of grid, which you can display your own custom message box whenever the grids CurrentCell.DisplayWarningText (as a result of some kind of validation error) is called.

Please refer the attached sample for the implementation.

InvalidDatatype.zip

private void gridDataBoundGrid1_CurrentCellErrorMessage(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellErrorMessageEventArgs e)
{
MessageBox.Show(e.Text,"NewError",MessageBoxButtons.OKCancel );
e.Cancel = true;
}

Best Regards,
Babu


AD Administrator Syncfusion Team January 5, 2007 09:20 AM UTC

Hi Babu,

thank you for your reply.

But I am using Gridcontrol. It does not have the CurrentCell.CurrentCellErrorMessage event. I am using Syncfusion 3.0.0.19.

Kun

>Hi Kun,

You can handle the CurrentCellErrorMessage event of grid, which you can display your own custom message box whenever the grids CurrentCell.DisplayWarningText (as a result of some kind of validation error) is called.

Please refer the attached sample for the implementation.

InvalidDatatype.zip

private void gridDataBoundGrid1_CurrentCellErrorMessage(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellErrorMessageEventArgs e)
{
MessageBox.Show(e.Text,"NewError",MessageBoxButtons.OKCancel );
e.Cancel = true;
}

Best Regards,
Babu


AD Administrator Syncfusion Team January 5, 2007 10:53 AM UTC

Hi Kun,

Sorry for the incovenience caused.

In Essential Studio 3.x, There is no event named CurrentCellErrorMessage. It has newly added in Essential Studio V4.2. But you can customize the error messagebox in a cell by handling the CurrentCellValidating or CurrentCellValidate or CurrentCellValidateString event in a grid. Please refer to the below KB article for more details.

What are the different validation events and event members? When are they triggered and how are they used?

Thanks for your patience.

Best Regards,
Haneef


KU kun January 5, 2007 11:48 AM UTC

Thank you, that helped

>Hi Kun,

Sorry for the incovenience caused.

In Essential Studio 3.x, There is no event named CurrentCellErrorMessage. It has newly added in Essential Studio V4.2. But you can customize the error messagebox in a cell by handling the CurrentCellValidating or CurrentCellValidate or CurrentCellValidateString event in a grid. Please refer to the below KB article for more details.

What are the different validation events and event members? When are they triggered and how are they used?

Thanks for your patience.

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon