Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CustomValidators
- {
- [Required]
- [Required(ErrorMessage = "State Required")]
- public string drpStateId { set; get; }
- public System.Web.Mvc.SelectList drpState { set; get; }
- [Required(ErrorMessage ="Region Required")]
- public string txtRegion { set; get; }
- }
- @model InterviewTest.Models.CustomValidators
- @{
- ViewBag.Title = "Custom Validator";
- Layout = "~/Views/_Layout.cshtml";
- }
- <p>@Html.ActionLink("< Back", "Index")</p>
- @using (Html.BeginForm("CustomValidatorPost"))
- {
- @Html.ValidationSummary()
- <div class="container-fluid">
- <div class="row">
- <div class="col-sm-3">
- <div class="form-group">
- @Html.DropDownListFor(c => c.drpStateId, Model.drpState, "", new { @class = "form-control" })
- </div>
- </div>
- <div class="col-sm-6">
- <div class="form-group">
- @Html.TextBoxFor(x => Model.txtRegion, new { @class = "form-control" })
- @*<input type="text" id="txtRegion" name="txtRegion" class="form-control" />*@
- </div>
- </div>
- <div class="col-sm-3">
- <button type="submit" name="btnSubmit" id="btnSubmit" class="btn btn-default">Submit</button>
- </div>
- </div>
- </div>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement