如何在 Url.Action
中发送多个参数? ?
我有一个带有 Action 的 Controller ,我想要 2 个参数,但没有收到第二个参数。
我的代码是:
@Url.Action("Products", "Jquery", new { categoryid = 1, Productid = 2})
Publc Action Jquery(int categoryid ,int Productid)
{
}
但我只收到
categoryid
, 每次Productid
一片空白。请建议我该怎么做?
最佳答案
我有同样的问题,添加了@'s并且没有工作。
对我有用的是@Html.Raw
操作说明。
@Html.Raw(@Url.Action("Jquery", "Products", new { categoryid = 1, Productid = 2}))
public ActionResult Jquery(int categoryid, int Productid)
{
return View();
}
这样就可以得到 Controller 中的所有参数,而不仅仅是第一个。
关于asp.net-mvc - 如何在 Url.Action 中发送多个参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24178320/