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.
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
0
Accepted
Hi Jason,
Kind Regards,
Vladimir Iliev
Telerik
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"
];
}
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.
I only have minified javascript files, otherwsie I will fix it myself.
0
Hi Jason Li,
Vladimir Iliev
Telerik
As I mention this is the way the dataSource works - current behavior is expected and it's intended.
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...