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

Edit GGC cell not cause the datasource change

Hi, There In GGC, I noticed when you edit a cell content, leave to the next cell in the same row, the grid datasource (dataset) doesn''t change immediatly, only when I leave to next row, the dataset changes. This cause saving problem because I edit a cell, click the Save button, the code will check if the dataset has change, like mGridDataSet.HasChanges(), the datasource has no changes until you leave to the next row. How can I make the dataset changes whenever I edit a cell? Thanks Lan

4 Replies

AD Administrator Syncfusion Team April 3, 2006 09:52 AM UTC

Hi Lan, The problem you are facing is that, by default the new value is stirred in a local row cache and is being flushed to the datasource only when the row changes. If you want to do this on a cell by cell basis, then say in CurrentCellAcceptedChanges, first call EndEdit before you call Update. Here is the code snippet private void gridGroupingControl1_TableControlCurrentCellAcceptedChanges(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCancelEventArgs e) { this.gridGroupingControl1.Table.EndEdit(); this.sqlDataAdapter1.Update(this.dataSet11); } Best regards, Madhan


AD Administrator Syncfusion Team April 12, 2006 01:34 PM UTC

Hi Madhan, Thank you very much. It works for me. Regards, Lan >Hi Lan, > >The problem you are facing is that, by default the new value is stirred in a local row cache and is being flushed to the datasource only when the row changes. If you want to do this on a cell by cell basis, then say in CurrentCellAcceptedChanges, first call EndEdit before you call Update. > Here is the code snippet > > private void gridGroupingControl1_TableControlCurrentCellAcceptedChanges(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCancelEventArgs e) > { > this.gridGroupingControl1.Table.EndEdit(); > this.sqlDataAdapter1.Update(this.dataSet11); > } > >Best regards, >Madhan >


AD Administrator Syncfusion Team August 4, 2006 08:32 PM UTC

Hello Hadhan,
Now I got little problem for GroupingGridControl with Multiple Primary Keys table.
when I add a new row, enter first Primary key cell, leave the cell, this line ''this.gdBase.Table.EndEdit'' displays validation error Messagebox saying the second Primary Key cell can''t be null, when you click Messagebox''s OK, the content entered in the first Primary Key cell disappeared, the cursor moves to the second Primary Key cell. This makes you can never finish to enter a new row.
Please see two attached meesage files.
How can I get around? Thanks.

Lan Mo

my code:

private void gdBase_TableControlCurrentCellAcceptedChanges(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCancelEventArgs e)
{
// accept cell change
this.gdBase.Table.EndEdit();
DimButtons();
}

>Hi Madhan,
>Thank you very much. It works for me.
>Regards,
>
>Lan
>
>
>
>
>>Hi Lan,
>>
>>The problem you are facing is that, by default the new value is stirred in a local row cache and is being flushed to the datasource only when the row changes. If you want to do this on a cell by cell basis, then say in CurrentCellAcceptedChanges, first call EndEdit before you call Update.
>> Here is the code snippet
>>
>> private void gridGroupingControl1_TableControlCurrentCellAcceptedChanges(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCancelEventArgs e)
>> {
>> this.gridGroupingControl1.Table.EndEdit();
>> this.sqlDataAdapter1.Update(this.dataSet11);
>> }
>>
>>Best regards,
>>Madhan
>>

GridValidateMsg.zip


AD Administrator Syncfusion Team August 6, 2006 05:17 PM UTC

One possible solution is to not call this.gridGroupingControl1.Table.EndEdit()
every time you leave a cell. Instead, try calling it in your Save button code just before you check DataSet.HasChanges. This way you would not try to validate the record between entering one key and the second key.

Loader.
Live Chat Icon For mobile
Up arrow icon