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

RadGrid inside a FormView: Saving Data to DB with EF

4 Answers 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
blablabla
Top achievements
Rank 1
blablabla asked on 01 Sep 2011, 04:40 PM
Hi, here's the situation:

I have an asp:FormView w/ its corresponding ObjectDataSource and a bunch of fields. One of these fields is a usercontrol which contains a RadGrid and an associated ObjectDataSource. On the backend, I'm using entity framework 4.1.

Let's say I'm display a project in the formview. This project has several clients. The RadGrid is displaying the clients associated to the project and their information.

I have a save button at the top of the page to save all the information when I am in edit mode on the formview. In addition, when the formview is in edit mode, the RadGrid is also in edit mode.

When I click on save, I call the FormView.UpdateItem method. This calls the updatemethod of the ObjectDataSource associated with the FormView, allowing me to save the data specified in the regular fields.

Now this does not allow me to save the information that is specified in the RadGrid.

I tried manually firing the Update command of the radgird, thinking it will call the UpdateMethod of the ObjectDataSource associated to it, but that didn't work.
I thought that a possible solution would be to add a Parameter of type "Object" to the Formview's ObjectDataSource, and then sending a datatable or similar in the ObjectDataSource_Updating event, but I'm not sure how efficient that is, or if it's the best solution (or if it's even possible).

So my question: Does anyone know how I can save the information in the RadGrid which is within the formview when I press the Save button?

Thank you.

4 Answers, 1 is accepted

Sort by
0
Stacy
Top achievements
Rank 1
answered on 29 Feb 2012, 08:49 PM
I would also be interested in seeing an answer to this as I have a similar situation
0
Marin
Telerik team
answered on 05 Mar 2012, 02:43 PM
Hello Stacy,

 We have addressed the issue that you have with RadGrid in the other forum thread that you have opened. If you do not mind we will continue the communication there.
Please avoid posting the same questions in different forum threads.

All the best,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Stacy
Top achievements
Rank 1
answered on 05 Mar 2012, 08:24 PM
Actually, i have two issues hence two posts.  No solution was given to the person who posted the original question and that is an answer I would like to get.
0
Marin
Telerik team
answered on 06 Mar 2012, 11:35 AM
Hello,

 You can fire the update command manually from the code behind as shown in this help topic.

Greetings,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
blablabla
Top achievements
Rank 1
Answers by
Stacy
Top achievements
Rank 1
Marin
Telerik team
Share this question
or