有没有比使用 RenderAction 更好的实现表单的方法?
我正在开发一个 .Net MVC2 项目,我试图尽可能地模块化功能。其中一个方面是将表单放置在部分视图中,然后使用 RenderAction 调用该表单。这样表单的 GET、POST、验证和重定向就可以独立于父视图进行处理。
我读过博客和论坛等,它们表明这对于 MVC 来说不是理想的行为,但是我想不出解决办法。我遇到的主要问题是从渲染的操作重定向,我明白为什么我不能这样做。
我需要知道的是:如果我不能也不应该以这种方式编码我的模块,我应该如何编码它们以便它们独立于父视图?
I am working on a .Net MVC2 project where I am trying to modularize functionality as much as possible. One aspect of this would be to place a form in a partial views which is then called using RenderAction. This is so that the form's GET, POST, validation and redirection can be handled independently of the parent view.
I have read blogs and forums etc that suggest that this is not ideal behaviour for MVC, however I cannot think of a way round it. The main issue I am having is redirecting from the rendered action and I understand why I cannot do this.
What I need to know is this: if I can't and shouldn't code my modules in this way, how should I code them so they are independent of the parent view?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论