嗨我的页面有问题。我在同一页面中有一个视图页面和两个表单。使用jQuery弹出对话框问题
问题是我有一个主窗体和另一个窗体,它是由JQuery显示的。我的问题是当我打开对话框,提交它的窗体并返回视图时,对话框会出现。我不知道如何返回结果,它仍然会显示打开的对话框。
我需要你的帮助!
下面是我在我的应用程序中使用的代码。
.CSTHML窗体
@using (Html.BeginForm("Login2", "Account", FormMethod.Post, new { @id = "loginForm" }))
{
<a id="submitlink" href="#" class="button button-large">Sign In</a>
}
// This is the pop-up dialog box
@using (Html.BeginForm("TroubleSubmit", "Account", FormMethod.Post, new { @id = "troubleSubmitForm" }))
{
<a id="troubleSubmitLink" href="#" class="button">OK</a>
}
JQUERY
$('a#submitlink').click(function() {
$('#loginForm').submit();
});
$('a#troubleSubmitlink').click(function() {
$('#troubleSubmitForm').submit();
});
下面是我的控制器动作来处理的代码的对话框形式提交:
public ActionResult SignInTrouble(some parameter...)
{
// some operation and validation here
return View(); // ??? What view will I return? When I return "Login" it will reload the page and close the dialog box.
}
同样,怎么办我返回的视图仍然会显示对话框
一旦你提交页面重新加载的形式。如果您不想重新加载页面,则应该使用AJAX请求。 –
或iFrame,我认为jQuery对话框处理它们 –
你能给我一些示例代码吗? – Mat