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

Reg: GDBC

Hi,
I am using GDBC in my application.
I am having only one row in the grid. If i update one column and move to next column, the updated value is not getting updated to the source data table.
what need to be done so that the value should update to the source data table?

Note: Currently I am using CurrentCellValidated event.

Thanks,
Anna

9 Replies

AD Administrator Syncfusion Team September 1, 2006 09:43 AM UTC

Hi Anna,

To push all data to underlying datasource for every cell movement, you need to call in Binder.EndEdit Method(before calling this , you need to call the CurrentCell''s Edit method). Here is a code snippet.

this.grid.CurrentCell.EndEdit(); //saves the currentcell
this.grid.Binder.EndEdit(); //removes the pencil

Let me know if this helps.
Regards,
Haneef


AS Anna Srinivasan September 1, 2006 12:22 PM UTC

Hi,
If we use grid.CurrentCell.EndEdit(), it will commit to the grid and also commit to the data table. Problem here is, i couldnt get the modified row from the data table because it is already commit.

I want modified row from the data table when the user updates one column and move to next column.

Kindly help me on this.

Thanks,
Anna


AD Administrator Syncfusion Team September 1, 2006 01:23 PM UTC

Hi Anna,

Try this code to get the modified current row in a grid. Here is a code snippet

GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;

CurrencyManager cm = this.BindingContext[this.gridDataBoundGrid1.DataSource] as CurrencyManager;

DataRow modifiedRow = (cm.List as DataView).Table.NewRow();
modifiedRow.ItemArray = (cm.Current as DataRowView).Row.ItemArray ;

//You need to update the CurrentCell value to the modified row .Bcoz CurrentCell value updates after Row
int colIndex = this.gridDataBoundGrid1.Binder.ColIndexToField(cc.ColIndex);
modifiedRow[colIndex] = this.gridDataBoundGrid1.CurrentCell.Renderer.ControlValue;

//display the modified row content....
for(int i= 0;i< modifiedRow.ItemArray.Length;i++)
Console.Write(" >>> " + modifiedRow[i] );
Console.WriteLine();

Let me know if this helps.
Best Regards,
Haneef


AS Anna Srinivasan September 4, 2006 10:09 AM UTC

Hi,
Could you please suggest an event where we should write a code?

Thanks,
Anna


AD Administrator Syncfusion Team September 4, 2006 12:05 PM UTC

Hi Anna,

You can use the CurrentCellValidating / CurrentCellValidated event to get the modified row in a grid and let me know if this helps.

Thanks,
Haneef


AS Anna Srinivasan September 5, 2006 02:18 PM UTC

Hi,
Sorry haneef, I am getting little confuse on this. I am once again explain my problem.
Let say I am having data table dt(Only One row). I am assigning to the GDBC.
If i update that row, i need the updated dt to update to database.
How do i get the updated data table?
Please help me on this.

Thanks,
Anna


AD Administrator Syncfusion Team September 6, 2006 12:59 PM UTC

Hi Anna,

To update the modified cell data into underlying datasource for every cell movement, you need to call in Binder.EndEdit method followed by the CurrentCell.EndEdit Method in CurrentCellMoving event. After calling these method, you can get the update DataTable using the Datasource property of the grid. Below is a code snippet

//for update the underlying Datasource.
this.grid.CurrentCell.EndEdit();
this.grid.Binder.EndEdit();

//To get the updated Datatable after calling the EndEdit() method.
DataTable Updateddt = this.grid.DataSource as DataTable;

//To update the DataTable to sql server....
sqldataAdapter.Update(Updateddt);

Let me know if i am missing something.
Regards,
Haneef


AS Anna Srinivasan September 7, 2006 02:24 PM UTC

Hi,
If we use grid.CurrentCell.EndEdit(), it will commit to the grid and also commit to the data table. Problem here is, i couldnt get the modified row from the data table because it is already commit.(Note : Row state will be unchanged)

I want the data table which contains modified row.How do i get that.

Kindly help me on this.

Thanks,
Anna


AS Anna Srinivasan September 7, 2006 02:24 PM UTC

Hi,
If we use grid.CurrentCell.EndEdit(), it will commit to the grid and also commit to the data table. Problem here is, i couldnt get the modified row from the data table because it is already commit.(Note : Row state will be unchanged)

I want the data table which contains modified row.How do i get that.

Kindly help me on this.

Thanks,
Anna

Loader.
Live Chat Icon For mobile
Up arrow icon