有没有办法阻止模式在提交表单时关闭?
我正在处理电子邮件发送模式但是当点击提交按钮控制器返回视图时,如何防止这种情况?
模态代码:
@using (@Html.BeginForm("SendEmail", "Home", FormMethod.Post, new { @id = "form1", @enctype = "multipart/form-data" }))
{
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<span class="btn green fileinput-button">
<i class="fa fa-plus fa fa-white"></i>
<span >Attachment</span>
<input type="file" multiple="multiple" name="files" id="file">
</span>
<button class="btn btn-send" type="submit" >Send</button>
@ViewBag.Message
<br />
</div>
</div>
}
这是电子邮件控制器代码:
public ActionResult SendEmail(EmailContent emailContent, List<HttpPostedFileBase> files)
{
ViewBag.Message = "Email Sent Successfully!";
return RedirectToAction("Index","Home");
}
catch
{
ViewBag.Project = new SelectList(db.employees, "employee_id", "name");
ViewBag.Message = "Failed to Send Email, Please Try Again";
return RedirectToAction("Index","Home");
}
}
}
请帮助我想要返回没有视图,模态仍然打开。