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

GGC Validation handling

Hi

I would need to show an error provider in a cell , i noticed that the GGC already dose that when for example you enter letters in a numeric field.
My question is how can i show that icon and highlight the cell red when i do my own validation ?
How can i stop it from showing a message box?
Why is the message box showing three times?

Thanks for the any help
Regards
Francois


3 Replies

SR Sri Rajan Syncfusion Team May 23, 2008 01:06 AM UTC

Hi Francois,

Thank you for your interest in Syncfusion products.

To disable the default error message, you need to set the e.Inner.Cancel as true in TableControlCurrentCellErrorMessage event.

void gridGroupingControl1_TableControlCurrentCellErrorMessage(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellErrorMessageEventArgs e)
{
e.Inner.Cancel = true;
}


To show the error message when you are doing your own validation, you need to handle TableControlCurrentCellValidating event. Please refer the below code for more details.

void gridGroupingControl1_TableControlCurrentCellValidating(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCancelEventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
if (cc.ColIndex == 2)
{
try
{
int val = Convert.ToInt32(cc.Renderer.ControlText);
}
catch
{
MessageBox.Show("Invalid Number");
}
}
}


Here is the minimal sample which implements this task.
http://websamples.syncfusion.com/samples/grid.windows/F73775/main.htm

Please let me know if this helps.

Best Regards,
Srirajan



FB Francois Buhagiar May 23, 2008 06:40 AM UTC

Hi

I would actuality need to show the error in an error provider which is in the cell, so that the i don't need to use a message box.

Is that possible?

Regards



SR SubhaSheela R Syncfusion Team May 26, 2008 08:42 AM UTC

Hi Francois,

Sorry for the inconvenience caused.

You can supress error message from popup. Here is the minimal sample that shows the desired behavior for your reference:

GGCErrorProviderNoErrorMessage.zip

Please let me know if it helps.

Regards,
Subhasheela R



Loader.
Live Chat Icon For mobile
Up arrow icon