This is a migrated thread and some comments may be shown as answers.

[Solved] Getting updated dataset in code behind from RadGrid

3 Answers 216 Views
Grid
This is a migrated thread and some comments may be shown as answers.
peter joel
Top achievements
Rank 1
peter joel asked on 04 Feb 2010, 03:23 PM
Hi,

I am binding radgrid from code behind using a dataset.

Grid1.DataSource= MyDataSet;
Grid1.DataBind();

Now, when i update/delete or inset a new record, i want to retrieve the updated DataSet back. What's the best way to do it?

I want something

Grid1_InsertCommand(....)
{
   DataSet MyNewDS= Grid1.GetUpdatedDataSet();
}

I want to do a batch update of DataSet in the database, not on every insert command.

Thanks.

3 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 04 Feb 2010, 05:34 PM
You could do something similar to what is being done in the "Performing batch updates" documentation article since this gives you an idea of how to get all the new data etc. and send it to the data source. I think this should be all you need to get this implemented :)
0
peter joel
Top achievements
Rank 1
answered on 04 Feb 2010, 11:34 PM
Thanks for the reply schlurk.

I have seen those examples and also few on
http://www.telerik.com/help/aspnet-ajax/grdinsertupdatedeleteatdatabaselevel.html

The only way to retrieve the updated values seems to be using OwnerTableView

for example: e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
-----------------

Actually i am using Microsoft Enterprise Library with stored procedures to perform the operation. I need to pass on a dataset to enterprise library to do an UPDATE. Therefore I need replicate all the Grid changes into my ORIGINAL dataset.

Now, If i have a DataTable 20 columns in each table and I need to implement insert/update/delete. It would need to write too much code in InsertCommand,UpdateCommand & Deletecommand. Isn't there a way to get the table from RadGrid. for example...

DataTable dtNewTable= Grid1.getDataEditedTable();
(this table would have proper RowStatus for updated, deleted & added rows)

Then i would just pass this table to enterprise library?

Thanks,
Peter





0
Shinu
Top achievements
Rank 2
answered on 05 Feb 2010, 10:36 AM
Hi,

Take a look at the help documentt link which explains how to update the datatable  using ExtractValuesFromItem

Updating values in-place and with edit forms

Thanks,
Shinu
Tags
Grid
Asked by
peter joel
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
peter joel
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or