我有这个view
@using (Html.BeginForm("RegisterApartmentOwner", "Home", FormMethod.Post,
new { enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<div class="editor-label">
@Html.LabelFor(model => model.FirstName)
</div>
<div class="editor-field">
@Html.TextBoxFor(x => x.FirstName, new {placeholder = "Enter Your First Name" })
@Html.ValidationMessageFor(model => model.FirstName)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.LastName)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.LastName, new { placeholder = "Enter Your Last Name"})
@Html.ValidationMessageFor(model => model.LastName)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Password)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.Password, new { placeholder = "Enter Your Password"})
@Html.ValidationMessageFor(model => model.Password)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Password)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.Password, new { placeholder = "Enter Your Password Again"})
@Html.ValidationMessageFor(model => model.Password)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.MobileNumber)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.MobileNumber, new { placeholder = "Enter Your Mobile Number"})
@Html.ValidationMessageFor(model => model.MobileNumber)
</div>
<input type="submit" value="Register" class="submit"/>
}
我的问题是验证仅在字段为空时有效,但我希望验证发现两个密码不相等以及手机号码不是数字时等等。请问我该怎么办?