从mvc中的多个源发送参数到action方法 [英] send parameter to action method from multiple source in mvc
问题描述
我有一些标签,如:
I have some a tag like :
<a href='/Video/Cat/1'>Introduce</a>
<a href='/Video/Cat/2'>Review</a>
and in other group i have other links like :
<a href='/Video/Group/1'>Most View</a>
<a href='/Video/Group/2'>Most Popular</a>
现在我想通过两个参数在服务器端搜索和查询,例如评论组中的大多数poulars 。当我点击每个链接搜索结果更改为我的选择条件。在这种情况下,当点击一个链接时,我如何发送两个参数进行搜索操作?我想当我点击Review链接然后点击最流行的搜索方法获得两个参数catId和groupId。
谢谢
now i want to search and query in server side by two parameter such as most poulars in Review Groups . and when i click on each link search result change to my choice conditions . in this case how i can send two parameter to search action when click on just one link ? i want to when i click on Review link and then click on most popular the search method get two parameter catId and groupId .
thanks
推荐答案
使用Html.ActionLink可以轻松传递多个参数,如下所示
Using Html.ActionLink you can easily pass multiple parameters like below
@Html.ActionLink("Add Visit", "ActionName", "ControllerName",
new { id = Model.Id, secondParameter = Model.yourValue }, null)
http://msdn.microsoft.com/en -us / library / system.web.mvc.html.linkextensions.actionlink.aspx [ ^ ]
希望这有帮助
http://msdn.microsoft.com/en-us/library/system.web.mvc.html.linkextensions.actionlink.aspx[^]
Hope this helps
这篇关于从mvc中的多个源发送参数到action方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!