This question is locked. New answers and comments are not allowed.
Hi all
I keep getting the error below when I try to update my row:
"The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult _UpdateAjaxEditing(Int32)"
I have tried the following:
- changing the grid from popup to inline;
-used [ScaffoldColumn(false)] in a few primite properties;
-used ModelState.Remove("ID");
-used Fiddler and saw that all values are being passed;
-create my own ViewModels;
What is interesting is that I get the 500 server error but the method "_UpdateAjaxEditing" is never called(I have a breakpoint there).
ViewModel:=========== public class SccmSiteViewModel { //[ScaffoldColumn(false)] public Guid ID; public string Code { get; set; } public string Size { get; set; } }Controller:============ public class SccmSiteController : Controller { private UnitOfWork unitOfWork = new UnitOfWork(); public ActionResult Index() { return View(); } [GridAction] public ActionResult _SelectAjax() { var model = from e in unitOfWork.SccmSiteRepository.Get() select new SccmSiteViewModel { ID = e.ID, Code = e.Code, Size = e.Size }; return View(new GridModel { Data = model }); } [GridAction] public ActionResult _UpdateAjax(int id) { //this action is never called due to the 500 server error //some code here... }View:======@model IEnumerable<.Web.ViewModels.SccmSiteViewModel> @(Html.Telerik().Grid(Model) .Name("Grid") .DataKeys(keys => { keys.Add(p => p.ID); }) .DataBinding(dataBinding => { dataBinding.Ajax() .Select("_SelectAjax", "SccmSite") .Update("_UpdateAjax", "SccmSite"); }) .Columns(columns => { columns.Bound(p => p.Code).Width(130); columns.Bound(p => p.Size); columns.Command(commands => { commands.Edit().ButtonType(buttonType); }).Title("Commands"); }) .Editable(editing => editing.Mode(gridEditMode)))
Any help is appreciated.
Thanks