asp.net mvc - How to set a number range validation in html.textboxfor in cshtml view page in mvc4? -


code:

@html.textboxfor(x => x.percentnos, new {@class = "percentage-numbers"}) 

how set numbers limit 0 100 in @html.textboxfor in cshtml view page in mvc4?

you can use range attribute limit input 0 100. apply attribute (target) property of model using in view.

[range(0,100)] public int percentnos { get; set; } 

Comments