Praveen Kumar

Praveen Kumar

  • NA
  • 235
  • 22.5k

How to set validation for Email Address attributes only

Mar 29 2020 7:57 PM
@for (var i = 0; i < Model.Attributes.Count; i++)
{
<div class="form-group">
@Html.HiddenFor(model => model.Attributes[i].AddressValueName)
@Html.Label(@Html.DisplayFor(model => model.Attributes[i].AddressValueName).ToString(), htmlAttributes: new { @class = "control-label col-md-3" })
<div class="col-md-9">
@Html.EditorFor(model => model.Attributes[i].AddressValue, new { htmlAttributes = new { @class = "form-control" } })
@Html.HiddenFor(model => model.Attributes[i].AddressElement)
</div>
</div>
}

Answers (2)