mwr*_*ght 16 parameters asp.net-mvc
我正在使用Ajax.ActionLink来调用Controller中的Action,没有什么特别之处.我想将两个参数传递给Action.这可能使用Ajax.ActionLink吗?我认为这只是在AjaxOptions中包含多个值的问题:
<%= Ajax.ActionLink("Link Text",
"ActionName",
"ControllerName",
new { firstParameter = firstValueToPass, secondParameter = secondValueToPass },
new AjaxOptions{ UpdateTargetId = "updateTargetId"} )%>
Run Code Online (Sandbox Code Playgroud)
是否可以传递多个参数?
在哪里可以了解有关AjaxOptions的更多信息?
Ben*_*man 47
根据您为Ajax.ActionLink选择的重载,调用的参数routeData
可以包含将传递给操作的各种参数的匿名字典:
<%= Ajax.ActionLink("Link Text",
"DoSomething",
"AwesomeController",
new { foo = "foo1", bar = "bar1" },
new AjaxOptions{ UpdateTargetId = "updateTargetId"} )%>
Run Code Online (Sandbox Code Playgroud)
这与AjaxOptions
参数没有任何关系,这使您可以控制请求/响应的行为.
public class AwesomeController
{
public ActionResult DoSomething(string foo, string bar)
{
/* return your content */
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
45699 次 |
最近记录: |