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

[Solved] Batch Update using ObjectDataSource

1 Answer 118 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John Mark Mikhail
Top achievements
Rank 1
John Mark Mikhail asked on 29 Mar 2009, 06:31 AM
Hi,

I have a page that has two RadGrids and I want to do a batch update to both grids. Because there are two grids, having a update commanditem doesn't seem appropriate.

On the button click I call the following procedure:
For Each Item As GridEditableItem In RadGrid1.EditItems 
                ObjectDataSource1.UpdateParameters.Item("Field1").DefaultValue = Item("Field1").Text 
                ObjectDataSource1.UpdateParameters.Item("Field2").DefaultValue = Item("Field2").Text 
                ObjectDataSource1.UpdateParameters.Item("Field3").DefaultValue = Item("Field3").Text 
                ObjectDataSource1.UpdateParameters.Item("Field4").DefaultValue = Item("Field4").Text 
                ObjectDataSource1.UpdateParameters.Item("Field5").DefaultValue = Item("Field5").Text 
                ObjectDataSource1.UpdateParameters.Item("Field6").DefaultValue = Item("Field6").Text 
                ObjectDataSource1.Update() 
        Next 


The solution seems fairly simple, but it appears I'm missing something. Any help would be appreciated.

JM

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 01 Apr 2009, 10:37 AM
Hi John,

You need to properly reference the edit fields, and extract the values. This article contains one possible approach. Once you have extracted the data, you can update the underlying datasources.
I hope this helps.

Regards,
Yavor
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
John Mark Mikhail
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or