【问题标题】:how to call actionresult method in my controller from kendo grid in mvc4如何从 mvc4 中的剑道网格调用我的控制器中的 actionresult 方法
【发布时间】:2014-02-01 09:51:57
【问题描述】:

我想将 id 传递给我的 actionresult 方法 Delete

 public ActionResult Delete(Guid AssetTypeId)
    {
        //  _repo.DeleteAssetType(AssetTypeId);
        if (_repo.DeleteAssetType(AssetTypeId) == 1)
        {
            return Index();
        }
        else
        {
            TempData["AlertMessage"] = "The DELETE statement conflicted with the REFERENCE constraint ";
            return Index();
        }

来自剑道网格

.Action("Delete", "AssetType",new { AssetTypeId = "#=AssetTypeId#"  }))  

【问题讨论】:

标签: asp.net-mvc-4 methods kendo-ui actionresult


【解决方案1】:

我猜你的架构中声明了 AssetTypeId。在这种情况下,您不需要单独发送。您只需要在删除中捕获您的模型。删除它应该如下所示;您可以在here 的官方演示站点中查看详细信息。

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult EditingPopup_Destroy([DataSourceRequest] DataSourceRequest request, ProductViewModel product)
        {
            if (product != null)
            {
                productService.Destroy(product);
            }

            return Json(new[] { product }.ToDataSourceResult(request, ModelState));
        }

【讨论】:

    猜你喜欢
    • 2015-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-27
    • 1970-01-01
    • 2021-01-10
    • 1970-01-01
    相关资源
    最近更新 更多