I have a grid as follows in my view:
<% Html.Telerik().Grid(Model.RegisterDocuments) .Name("RegisterDocumentGrid") .DataKeys(keys => { keys.Add(o => o.ID); }) .DataBinding(dataBinding => { dataBinding.Ajax() .Select("_AjaxBinding", "Documents", ViewData.Model.RegisterHeader.Id) .Delete("_DeleteAjaxEditing", "Documents"); }) .Columns(columns => { columns.Bound(o => o.ID).Title("ID"); columns.Bound(o => o.File.OriginalFilename).Title("Document Name"); columns.Bound(o => o.MimeType).Title("Document Type"); columns.Bound(o => o.CreationDate).Format("{0:dd/MM/yyyy}").Title("Date Added"); columns.Bound(o => o.UserID).Title("Added By"); //columns.Command(commands => commands.Delete().ButtonType(GridButtonType.Text)).Title(""); columns.Command(commands => { commands.Delete().ButtonType(GridButtonType.Text); }).Width(180).Title("Commands"); }).Footer(false) .Render(); %>and in my Controller I have the following function:
[AcceptVerbs(HttpVerbs.Post)] [GridAction] public ActionResult _DeleteAjaxEditing(int documentId) { //do some stuff..... }Now if I try to delete a row from my grid I get a 500 Internal Server error. If I look at it in firebug I get the following error message:
"The parameters dictionary contains a null entry for parameter 'documentId' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult _DeleteAjaxEditing(Int32)' in 'AsbestosRegister.Web.Controllers.Asbestos.DocumentsController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameter name: parameters"
So....obviously it is expecting an int to be passed as a parameter into _DeleteAjaxEditing. I have based mine of the examples online e.g. http://demos.telerik.com/aspnet-mvc-beta/grid/editingajax and it doesn't pass an int into it's delete method which has an int as a parameter.
What am I doing wrong?!
Any help much appreciated.