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

Commiting Row Changes to datatable

I am trying to commit the changes made to a data table once the user clicks a PushButton. The fields are all static until the user clicks the modify pushbutton. From there I used this code to change the static fileds using the Prepare View Style Info Event

if(e.RowIndex > 0)
{
if(e.RowIndex == this._rowIndex && e.ColIndex == this.gridDataBoundGrid1.GridBoundColumns.IndexOf(this.gridBoundColumnQty)+ 1)
{
if(this._rowEditable)
{
this.gridDataBoundGrid1.Model.IgnoreReadOnly = true;
e.Style.Clickable = true;
e.Style.ReadOnly = false;
e.Style.Enabled = true;
e.Style.CellType = "NumericUpDown";
e.Style.NumericUpDown = new GridNumericUpDownCellInfo(1,100000,100,1,true);
e.Style.CellAppearance = Syncfusion.Windows.Forms.Grid.GridCellAppearance.Raised;

}
else
{
this.gridDataBoundGrid1.Model.IgnoreReadOnly = false;

e.Style.Clickable = false;
e.Style.ReadOnly = true;
e.Style.Enabled = false;
e.Style.CellType = "Static";
}
}

However what this does is it is saving the changes into the datatable before I hit the commit button. How can I prevent this? It looks like it is making the cells editable.

thanks

4 Replies

JO John April 30, 2007 05:17 PM UTC

I forgot to add I am using a GDBG control


HA haneefm Syncfusion Team April 30, 2007 05:39 PM UTC

Hi John,

By Defalut, The CauseValidation property of any control is TRUE. It indicates whether the control can cause validation to be performed on any controls that require validation when it receives the focus.

In such scenario the grid's Validate method will get called which then will commit changes in the grid to the underlying datasource. So you need to set the CauseValidation property of the Button control ( CommitButton ) to FALSE.

this.commitButton.CauseValidation = false;

Best regards,
Haneef


JO John April 30, 2007 06:11 PM UTC

Ok I included a example of what I am trying to acomplish. I actually don't mind having the row become editable. Is there a way to revert back to the old values after the user clicks a GBDG PushButton?

thanks

WindowsApplication233.zip


JO John May 1, 2007 03:39 PM UTC

NVM Figured it out by using CancelEdit for the model and current Cell to reset values

Loader.
Live Chat Icon For mobile
Up arrow icon