RenderAction - 使用它而不影响父级

发布于 2024-08-12 09:37:55 字数 180 浏览 3 评论 0原文

如果我在视图具有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野心澎湃 2024-08-19 09:37:55

Html.BeginForm() 只是将 Request.Url.ToString() 放入表单 action 参数中。当您使用 Html.BeginForm("actionName", "controllerName") 时,将使用路由来计算 url。

Html.BeginForm() simply puts Request.Url.ToString() in the form action parameter. When you use Html.BeginForm("actionName", "controllerName") routing will be used to calculate the url.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文