I have a custom Edit template working with a grid in that when I show the grid and click the "Edit" button it shows the popup with the data. I can edit the data and choose the "Update" button and the popup closes. I can click the "Edit" button again and the popup shows with the modified data. So far so good.
But two things are happening that are not good. If I click the "Cancel" button I get the following error:
Unhandled exception at line 27, column 1898 in http://localhost:51277/Scripts/kendo/2016.1.18/kendo.all.min.js
0x800a138f - JavaScript runtime error: Unable to get property 'uid' of undefined or null reference
Also the data from the Popup is not populating the underlying row visually in the grid. The popup only has a few of the columns in the grid row but again they remain empty when the popup closes. When the popup shows again if you again click the "Edit" button the data is in the fields.
I have this at the top of the custom editor template which is the unique ID for the row.
@Html.HiddenFor(model => model.strNotificationSubscriptionSeq)
The following code is in place in the Grid markup:
.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("NotificationSubscriptionEditor"))
The Datasource in the grid defines the update method on the controller:
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => { model.Id(p => p.strNotificationSubscriptionSeq); })
.Batch(true)
.PageSize(25)
.ServerOperation(false)
.Events(events => events.Error("error_handler"))
.Update("NMSubscriptionUpdate", "NotificationMgr")
)
One thing to note is that the spec for the main template that contains the grid is to do a batch update for all the rows in grid that are modified. I have that concept working in other templates which send the JSON to the controller. All that is working fine but I mention the spec here to state that the controller method does nothing on the backend and just returns the data row item sent into the controller. When the user clicks the master "Save" button I will post the data to the database.
Here is the controller method:
public ActionResult NMSubscriptionUpdate([DataSourceRequest] DataSourceRequest request,[Bind(Prefix = "models")] GridNotificationSubscriptionDataItem gridNMSubscription)
{
return Json(gridNMSubscription, JsonRequestBehavior.AllowGet);
}
Does someone have a suggestion as to what is going wrong here? Do I need some JavaScript in the Editor template or the parent main Razor view?
Thanks!
Reid