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

Detect error in formula

hi,
how can I detect a formula entered by user has error in GridControl?
for example it's typed if(C1-- it doesn't have ) --



1 Reply

MA Manikandan Syncfusion Team June 27, 2011 01:01 PM UTC

Hi Mehrdad,

Thanks for using Syncfusion Products.

By default we validate the formula expressions internally. We don't have any method to perform the validation explicitly. However You can achieve your requirement by handling CurrentCellEditingComplete event as follows:

Code Snippet [C#]

this.grid.CurrentCellEditingComplete += new Syncfusion.Windows.ComponentModel.GridRoutedEventHandler(grid_CurrentCellEditingComplete);

void grid_CurrentCellEditingComplete(object sender, Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs args)
{
int row = this.grid.CurrentCell.RowIndex;
int col = this.grid.CurrentCell.ColumnIndex;

if (this.grid.Model[row, col].Text == this.grid.Model[row, col].FormattedText)
{
MessageBox.Show("Error Message");
}
}

We have prepare a sample based on this, please find the sample from the following location.

Sample: http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=Sample_Grid1269947087.zip

Please let us know if this helps.

Regards,
Manikandan



Loader.
Live Chat Icon For mobile
Up arrow icon