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.
Unfortunately, activation email could not send to your email. Please try again.

Commiting Row Changes to datatable

Thread ID:

Created:

Updated:

Platform:

Replies:

60202 Apr 30,2007 12:47 PM May 1,2007 11:39 AM Windows Forms 4
loading
Tags: GridControl
John
Asked On April 30, 2007 12:47 PM

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

John
Replied On April 30, 2007 01:17 PM

I forgot to add I am using a GDBG control

haneefm [Syncfusion]
Replied On April 30, 2007 01:39 PM

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

John
Replied On April 30, 2007 02:11 PM

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

John
Replied On May 1, 2007 11:39 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;