如果提交按钮在@using 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>
}
Run Code Online (Sandbox Code Playgroud)
输出是一个 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>
Run Code Online (Sandbox Code Playgroud) 该RequiredAttribute
工程string
,但没有DateTime
。例如:
[Required]
[DisplayFormat(ConvertEmptyStringToNull = false)]
public string Name { get; set; }
[Required]
[DataType(DataType.DateTime)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd-MMM-yyyy}", ConvertEmptyStringToNull = false)]
public DateTime Birthdate { get; set; }
Run Code Online (Sandbox Code Playgroud)
如果Name
为空,则验证显示错误,但如果Birthdate
为空,则没有任何反应。我在看:
和
但仍然不适用于 DateTime