dimanche 28 juin 2015

c# mvc validation text

I have edit bar for gender and i want to valid it (Male or Female), there is my model class:

        public int CustomerID { get; set; }
        public int BranchID { get; set; }

        public string FirstName { get; set; }

        public string SirName { get; set; }

        public int Age { get; set; }

        public string Gender  { get; set; }

and here is my view part i want to valid:

       <div class="editor-label">
        @Html.LabelFor(model => model.Gender)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.Gender)
           @Html.ValidationMessageFor(model => model.Gender)
       </div>

Aucun commentaire:

Enregistrer un commentaire