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

Kendo UI Batch Editing Grid not posting back to SQL Server when saving changes

5 Answers 206 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Staci
Top achievements
Rank 1
Staci asked on 26 Nov 2012, 11:02 AM

Hi There,

I have implemented a batch editing grid which populates correctly and allows me to edit rows, but when I hit "save changes" the changes are only saved in the grid, they're not being posted back to the database.

Can you please have a look at my code and let me know why this is not happening and how I can fix this. Attached is the files related to this control.

Many Thanks,
Staci

5 Answers, 1 is accepted

Sort by
0
Staci
Top achievements
Rank 1
answered on 26 Nov 2012, 03:19 PM
My post is not displaying correctly so I have re-added it here.

Hi There,

I have implemented a batch editing grid which populates correctly and allows me to edit rows, but when I hit "save changes" the changes are only saved in the grid, they're not being posted back to the database.

Can you please have a look at my code and let me know why this is not happening and how I can fix this. I Attached the files related to this control in the above post.

Many Thanks,
Staci

0
Nikolay Rusev
Telerik team
answered on 27 Nov 2012, 07:12 AM
Hello Staci,

As far as I can see form your implementation this is expected. The items are only updated in the collection saved in the Session object.

//from MetricScoreRepository.cs
 
public static IList<MetricScoreModel> All()
{
            IList<MetricScoreModel> result = (IList<MetricScoreModel>)HttpContext.Current.Session["tbl_MetricScores"];
 
            if (result == null)
            {
                HttpContext.Current.Session["tbl_MetricScores"] = result =
                    (from metricScore in new FrontEndDBSQLDataContext().tbl_MetricScores
                     select new MetricScoreModel
                     {
                         MetricScoresID = metricScore.MetricScoresID,
                         //Date = (DateTime)metricScore.Date,
                         MetricName = (int)metricScore.MetricName,
                         MetricDescription = metricScore.MetricDescription,
                         CampaignName = (int)metricScore.CampaignName,
                         AffiliateName = (int)metricScore.AffiliateName,
                         MetricScore = (int)metricScore.MetricScore
                     }).ToList();
            }
            return result;
}


All the best,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Staci
Top achievements
Rank 1
answered on 03 Dec 2012, 11:07 AM
Thank's for the reply, I thought it also updated the table data in the database as the grid is populated from this table. Can you please tell me how I also update the data in the database as I need these changes to be saved there?

Many Thanks
0
Nikolay Rusev
Telerik team
answered on 05 Dec 2012, 10:25 AM
Hello Staci,

How to submit those changes to the database depends entirely on the middle tier that you are using for communicating with the database.

 - in case of using Linq2Sql http://msdn.microsoft.com/en-us/library/bb399378.aspx
 - in case of using Entity Framework http://stackoverflow.com/questions/7811355/committing-changes-to-the-database-using-entity-framework


Regards,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Luis Ernesto
Top achievements
Rank 1
answered on 05 Dec 2012, 07:27 PM
hi, i have the same problem, can you have a little example how to implement the submit to changes the database?
Tags
Grid
Asked by
Staci
Top achievements
Rank 1
Answers by
Staci
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Luis Ernesto
Top achievements
Rank 1
Share this question
or