RenderAction - 使用它而不影响父级
如果我在视图具有 Html.BeginForm() 且没有参数的操作方法上调用 RenderAction,我的表单操作将遵循父 url。
如果我添加任何参数(路由值、操作等),表单操作属性将替换为 MyChildContorller 的控制器名称和操作。
如何在不影响父url的情况下使用RenderAction?
If I call RenderAction on action method which view has Html.BeginForm() with no params my form action folows the parent url.
If I add any param (route values, action, etc) , form action attribute is replaced with MyChildContorller's controller name and action.
How to use RenderAction without affecting parent url?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Html.BeginForm()
只是将Request.Url.ToString()
放入表单action
参数中。当您使用Html.BeginForm("actionName", "controllerName")
时,将使用路由来计算 url。Html.BeginForm()
simply putsRequest.Url.ToString()
in the formaction
parameter. When you useHtml.BeginForm("actionName", "controllerName")
routing will be used to calculate the url.