从mvc 4中的局部视图重定向 [英] redirection from a partial view in mvc 4

查看:89
本文介绍了从mvc 4中的局部视图重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个学生入学申请表。

在这里,有一个视图(索引),其中有2种不同的形式使用部分视图。如果输入错误,表单将呈现无效,并且应该重定向到另一页。

重定向发生在部分视图函数中,输出不是我想要的,即它在视图内的局部视图内的视图。

如何解决这个问题?请帮助....

I have an application form for student admission.
In this, there is a View (Index) in which it has 2 different forms using partial views. In case of a wrong input, the form is rendered invalid and the it should redirect to another page.
The redirection happens from the partial view functions, the output is not exactly what i want, i.e. its a view within a partial view within a View.
how to fix this?? please help....

推荐答案

部分视图在另一个视图中呈现。您的顶视图确实需要进行重定向,否则您将重定向到部分视图中呈现的内容,而不是主视图。你需要重新考虑你的逻辑。
A partial view gets rendered inside another view. Your top view really needs to do the redirecting, otherwise you're redirecting to what gets rendered in your partial view, not your main view. You need to rethink your logic.


这篇关于从mvc 4中的局部视图重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆