How can I use Html.Action?

前端 未结 3 560
误落风尘
误落风尘 2020-12-01 10:10

I am trying to understand how to use:

@Html.Action(\"GetOptions\", )

What I would like to do is to pass a call to my controller and pass th

3条回答
  •  不思量自难忘°
    2020-12-01 10:48

    You should look at the documentation for the Action method; it's explained well. For your case, this should work:

    @Html.Action("GetOptions", new { pk="00", rk="00" });
    

    The controllerName parameter will default to the controller from which Html.Action is being invoked. So if you're trying to invoke an action from another controller, you'll have to specify the controller name like so:

    @Html.Action("GetOptions", "ControllerName", new { pk="00", rk="00" });
    

提交回复
热议问题