How can I pass parameters to an Action using Html.Action() in ASP.NET MVC?

送分小仙女□ 提交于 2019-12-03 09:18:40
Roberto Hernandez

You could specify additional data in the RouteValues property like this.

Html.Action("ActionName","Controller", new { id = 1 })

To add a little on this question, I am using ASP.Net MVC 5 and I could succeed to achieve this with this code:

@Html.Action("foo",new {parameter1=1})
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!