HtmlHelperExtension 方法中的 RenderAction?
我试图在我自己的 Html Helper 中调用 RenderAction 扩展方法:
System.Web.Mvc.Html.ChildActionExtensions.RenderAction(helper, "account", "login");
这样除了一些额外的逻辑之外,我希望所有 html helpers 在视图上调用它时使用通用的方法名称结构:
<%= Html.CompanyName().RenderAccount() %>
但我的问题是问题是,asp.net 会抱怨找不到它需要处理的实际路由。它不接受用作操作的“控制器”和用作操作的“登录”参数。似乎只参考当前路线。
有什么想法可以打包 RenderAction 吗?
I am trying to call the RenderAction Extension Method within my own Html Helper:
System.Web.Mvc.Html.ChildActionExtensions.RenderAction(helper, "account", "login");
this is so that along with some additional logic, I would like all html helpers to use a common method name structure when calling it on the view:
<%= Html.CompanyName().RenderAccount() %>
but the problem I am having is that, asp.net will complain about not finding the actual route it needs to process. It does not take in the parameters of "controller" to be used as the action and "login" to be used as the action. It seems to only reference the current route.
Any ideas how I can package up the RenderAction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对不起大家,我犯了一个错误:
应该是:
现在已经解决了。
Sorry all, I made a mistake:
It should have been:
This is now resolved.