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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to Write GridControl Values to a DataTable/Database

Thread ID:





29576 May 27,2005 10:39 PM UTC May 27,2005 11:37 PM UTC WinForms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On May 27, 2005 10:39 PM UTC

We are using the GridControl where we read an Oracle database Table into a DataTable and then populate the gridcontrol. When the user is done making changes and selects the save feature what is most efficient way to write back the entire grid contents to the Database. Bob

Administrator [Syncfusion]
Replied On May 27, 2005 11:37 PM UTC

I assume you have used a DataAdapter of some type to load the data into a DataSet/DataTable, and then have moved the data from the DataTable into the GridControl. If you want to, you can handle the grid.SaveCellInfo event. In the handler, assuming dataTable1 is the DataTable, you can use code similar to the code below to move the changes back into the DataTable as the user makes the changes. Then when you want to move these changes back into the database, you can call DataAdapter.Update. You would not have to move the changes from the grid to the Datatable as that would have been done as the user typed and left the cell.
private void grid_SaveCellInfo(object sender, GridSaveCellInfoEventArgs e)
	if(e.RowIndex > 0 && e.ColIndex > 0)
		dataTable1.Rows[e.RowIndex - 1][e.ColIndex - 1] = e.Style.CellValue;


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon