0
如果提交按鈕位於@using Html.BeginForm中,是否有任何方法可以打開新窗口?我嘗試了以下,但它不起作用?如何使用Html.BeginForm打開新窗口
@using (Html.BeginForm("SetCol", "Document", FormMethod.Post, new {target="_blank"})){
<div class="modal-body" data-height-relative="20">
.
.
.
</div>
<div class="modal-footer">
<div class="pull-right">
<input type="submit" value="Senden" class="btn btn-primary"/>
<a href="@ViewData["closeUrl"]" class="btn btn-primary" @(ViewData["closeUrl"] == "#" ? "data-dismiss=modal" : "")>@Translations.Close</a>
</div>
</div>
}
輸出爲PDF文件:
<html>
<body marginwidth="0" marginheight="0" style="background-color: rgb(38,38,38)">
<embed width="100%" height="100%" name="plugin" src="http://localhost:54906/Document/SetCol?id=108" type="application/pdf">
</body>
</html>
可能重複[Javascript Post on Form提交打開新窗口](http://stackoverflow.com/questions/178964/javascript-post-on-form-submit-open-a-new-window) – CodeCaster 2015-04-03 09:46:19
你有錯誤的目標,你需要'_blank'而不是'_self'。但請不要這樣做,這是糟糕的用戶體驗。 – CodeCaster 2015-04-03 09:47:07
我嘗試過blank_,但仍然在相同的窗口中看到結果。爲什麼是可怕的,有什麼選擇? – user576914 2015-04-03 09:49:46