My validation message is not displaying... i typed [Required] before the properties in one of my models and then in the view i wrote
Code:
@html.ValidationSummary(true)
and also wrote
Code:
@html.validationMessageFor(m=>m.property)
for each .. but message is not displaying ....
this is my code..
Code:
@model MyMVCApp.Models.Surveyor
@{
ViewBag.Title = "Log in";
Layout = "~/Views/Shared/_LayoutPage1.cshtml";
}
<h1>@ViewBag.Title</h1>
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>Log in Form</legend>
@Html.LabelFor(m => m.SurveyorName)
@Html.TextBoxFor(m => m.SurveyorName)
@Html.ValidationMessageFor(m => m.SurveyorName)
@Html.LabelFor(m => m.Password)
@Html.PasswordFor(m => m.Password)
@Html.ValidationMessageFor(m => m.Password)
<input type="submit" value="Log in"/>
</fieldset>
<br />
}