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

Why always post Create action even when click update button?

5 Answers 135 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 03 Jul 2013, 09:26 PM
I created MVC 3 web application and then convert it to Kendo UI for ASP.NET MVC application. Plz see attached project.

There is a simple grid on index page, add new item button is on grid toolbar, edit and destroy buttons are in column.

I could add new row successfully, but when I try to edit existing row, another create action is posted again. Refresh page, two rows in grid. the same thing happens when I try to delete a row.

Why? Am I missing anything there?

Please advise.

5 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Iliev
Telerik team
answered on 05 Jul 2013, 11:10 AM
Hi Jason,

 
After reviewing the provided project it seems that the issue comes from invalid ID of the current record that is added to the Grid - it has ID equal to "0", however the Grid identifies all records with ID equal to "0" as new records. After setting the ID to be equal to "1", the Update action is correctly called:

private HomeModel GetModel()
{
    if (Session["HomeModel"] == null)
    {
        Session["HomeModel"] = new HomeModel
        {
            //all records must have model ID > 0
            Records = new List<Record> { new Record { Identity = 1, DateTime3 = DateTime.Now, Number1 = 0, String2 = "first" } }
        };
    }
 
    return (HomeModel)Session["HomeModel"];
}
Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jason
Top achievements
Rank 1
answered on 05 Jul 2013, 02:05 PM

Thank you for your help. However, could we recognize it as a bug? For now I only have minified js files otherwise I will fix it myself.

Thanks again.

0
Jason
Top achievements
Rank 1
answered on 05 Jul 2013, 02:06 PM
Thank you for your help. Anyway, could you recognize it as a bug and fix it?
I only have minified javascript files, otherwsie I will fix it myself.
0
Vladimir Iliev
Telerik team
answered on 08 Jul 2013, 08:06 AM
Hi Jason Li,

 
As I mention this is the way the dataSource works - current behavior is expected and it's intended. 

Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jason
Top achievements
Rank 1
answered on 08 Jul 2013, 01:30 PM
If you say so...
Tags
Grid
Asked by
Jason
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Jason
Top achievements
Rank 1
Share this question
or