Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Re: How to set validation for select list in mvc 6

$
0
0

Thanks for your help but i have applied all these 

for exaple in model i have applied "Required" attribute to year filed.

for example : code 

<select asp-for="Year">
<option selected value=""></option>
<option value="2015">2015</option>
<option value="2014">2014</option>

</select>

<span asp-validation-for="Year"></span>

Other fields validation are working fine but for select item it is not working at all. Dont you think that we need to pass data source from c# then only it will work. hmm? 

can you give me a live example ?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>