尝试执行删除操作时获取System.ArgumentException [英] Getting System.ArgumentException when trying to perform delete operation
问题描述
您好!全部,
我已经通过以下文章为基本的CRUD操作创建了一个ASP.Net MVC 4应用程序
[ ^ ]。
在此之后我实现了Kendo UI Grid,编辑功能很好但当我尝试删除时行,我收到以下错误:
Hello! All,
I have created an ASP.Net MVC 4 application for basic CRUD operations by following this article
[^].
After this I have implemented the Kendo UI Grid, the Edit Functionality works great but when I try to delete the row, I'm getting the following error:
参数字典包含非可空类型'System.Int64'的参数'id'的空条目,用于'Skydentech.Controllers.EHRController'中方法'System.Web.Mvc.ActionResult Delete(Int64)'。可选参数必须是引用类型,可以为空的类型,或者声明为可选参数。
参数名称:参数
The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int64' for method 'System.Web.Mvc.ActionResult Delete(Int64)' in 'Skydentech.Controllers.EHRController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameter name: parameters
如果我删除了Kendo Grid并回到原来的东西,那就完美了。如何实现与Kendo Grid一起使用的删除功能。
谢谢。
If I remove the Kendo Grid and move back to the original stuff it works perfect. How can I implement delete functionality which works with Kendo Grid as well.
Thanks.
推荐答案
你的应用程序尝试删除项目,但它无法传递要删除的项目的ID。在删除视图上尝试新的{id = Model.ID}。 ID取决于您在应用程序中命名的内容。
Your application attempts to delete an item but it cant pass the id for that item to delete. Try something like new{id=Model.ID} on the delete view. The ID depends on what you named yours in ur application.
这篇关于尝试执行删除操作时获取System.ArgumentException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!