我是靠谱客的博主 帅气火车,这篇文章主要介绍html 传递对象参数,HTML.ActionLink传递对象具有参数(示例代码),现在分享给大家,希望可以做个参考。

我正在尝试将具有参数的对象类型传递给控制器​​。我尝试直接传递对象。例外:`System.Web.Mvc.HtmlHelper` has no applicable method

named `ActionLink` but appears to have an extension method by that name.

Extension methods cannot be dynamically dispatched. Consider casting

the dynamic arguments or calling the extension method without the

extension method syntax.

即使我添加了用于类型转换的代码,但仍会如上所述引发编译错误InProgressGrid.Column(header: "File Name", columnName: "FileName",format:(item) => Html.ActionLink(((string)item.FileName), "DownloadReport", (Domain.UserObject)item ,null))

有什么方法可以将多个参数传递给控制器​​操作方法InProgressGrid.Column(header: "File Name", columnName: "FileName",format:(item) => Html.ActionLink(((string)item.FileName), "DownloadReport", new {FileName = item.FileName,PK= item.PartitionKey },null)),

现在,当我运行应用程序时,我仅看到一个属性,即。传递FileName,但没有PartitionKey传递给Controller的操作参数。

为了满足上述条件,全局路由中是否有任何更改?

最后

以上就是帅气火车最近收集整理的关于html 传递对象参数,HTML.ActionLink传递对象具有参数(示例代码)的全部内容,更多相关html内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(116)

评论列表共有 0 条评论

立即
投稿
返回
顶部