I want to validate phone no. using data annotation
<li class="cell last" style="width: 60%;">
@Html.TextBoxFor(model => model.PhoneNumber, new { @class = "textbox" }) @Html.ValidationMessageFor(model => model.PhoneNumber)
</li>
Home / DeveloperSection / Forums / phone validation in Mvc
I want to validate phone no. using data annotation
<li class="cell last" style="width: 60%;">
@Html.TextBoxFor(model => model.PhoneNumber, new { @class = "textbox" }) @Html.ValidationMessageFor(model => model.PhoneNumber)
</li>
Prakash nidhi Verma
08-Jun-2018hi folks, if you want to validation phone number annotation in MVC.
use this code which is shown below:
please check your Models and Views properly:
this Data Annotation alone is enough if you need regex for validation. as you want to using data annotation so its helpful for you which is shown below:
Syntax:
Code:
I hope, It will be helpful for you.
Happy Coding :)