or
[HttpPost]
public ActionResult Create( [DataSourceRequest]DataSourceRequest request, [Bind(Prefix = "models")]FormCollection addedRoles) {
try { // code here to update the database from the addedRoles FormCollection. This part works fine. ModelState.Clear() // I added this in to see if it makes a difference...it does not. }catch (Exception ex) {
ModelState.AddModelError("", ex.Message);
}
return Json(ModelState.ToDataSourceResult());
}
var desk = $("#window"); $("#openEmail").click(function (e) { desk.contents() = "test"; desk.data("kendoWindow").open(); });[HttpPost]However this code fails with the error:
public ActionResult AjaxDelete([DataSourceRequest]DataSourceRequest request, tbl_app_Customer customerToDelete) {
if (customerToDelete != null) {
db.tbl_app_Customer.Attach(customerToDelete);
db.ObjectStateManager.ChangeObjectState(customerToDelete, EntityState.Deleted);
db.SaveChanges();
}
return Json(ModelState.ToDataSourceResult());
}