我的MVC 4验证工作,因为它看来,这些错误信息弹出,但它仍然提交表单。 任何想法,我缺少什么? 谢谢。
public class StatusRequestModel
{
[Required]
[Display(Name = "Ticket Number")]
public int? TicketNumber { get; set; }
[Required]
[Display(Name = "Postal Code")]
public int? PostalCode { get; set; }
}
@using (Html.BeginForm())
{
@Html.ValidationSummary()
@Html.LabelFor(x => x.TicketNumber)
@Html.TextBoxFor(x => x.TicketNumber)
@Html.LabelFor(x => x.PostalCode)
@Html.TextBoxFor(x => x.PostalCode)
<input type="submit" value="Submit" />
<input type="reset" value="Reset"/>
}