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
close icon

Unbound Field SaveValue call back

Hi,

We have grid grouping control with Unbound fields with 2 call back functions for QueryValue and SaveValue to handle the editing of cells for unbound fields.
 

this.gridGroupingControl1.TableDescriptor.UnboundFields.Add(fieldDescriptor);

this.gridGroupingControl1.QueryValue += new FieldValueEventHandler(gridGroupingControl1_QueryValue);

this.gridGroupingControl1.SaveValue +=gridGroupingControl1_SaveValue;

 

 

The query :

 

1) The unbound field has a field descriptor of fieldProperty Type - DOUBLE, say with a default value 48.14

2) If the user edit the cell and enters a non double value, eg : string value (say 'abcd') in any cell of that unbound field. How can we make sure that the   invalid value of 'abcd' value is reset back to 48.14 (the previous valid value for that cell) silently in SaveValue call back function i.e   gridGroupingControl1_SaveValue.

 

As of now, the value stays as 'abcd' with an error, but we do not want to show the error and revert the value to the previous valid value. 

 

 

Can you please revert asap as we have a major production issue regarding this.

 

Thanks,

Hari


1 Reply

SA Solai A L Syncfusion Team October 7, 2015 10:39 AM UTC

Hi Syed,

Thank you for your interest in Syncfusion products. 


To avoid the error messages and replace with correct values.

We can avoid the error messages by setting the ShowErrorMessageBox value to false. In the keydown event, we customized the sample to replace the non-numeric values with the default value.


Code :

//Error provider Properties

this.gridGroupingControl1.TableControl.ShowRowHeaderErroricon = false;this.gridGroupingControl1.TableControl.CurrentCell.ShowErrorIcon = false;

this.gridGroupingControl1.TableControl.CurrentCell.ShowErrorMessageBox = false;

this.gridGroupingControl1.TableControl.CurrentCell.ValidationErrorText = string.Empty;

  void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender,GridTableControlKeyEventArgs e)

        {

            double temp = 0;

            if (e.Inner.KeyCode == Keys.Enter && !(double.TryParse(this.gridGroupingControl1.TableModel.CurrentCellRenderer.ControlText.ToString(),outtemp)))

            {

                this.gridGroupingControl1.TableModel.CurrentCellRenderer.ControlText = defaultvalue.ToString();

                this.gridGroupingControl1.Refresh();

            }


        }

Sample :
http://www.syncfusion.com/downloads/support/forum/120705/ze/RefreshUnboundFields-CS1711288028



Thanks & Regards,
AL.Solai.


Loader.
Live Chat Icon For mobile
Up arrow icon