How to set number range check in html.textboxfor on cshtml view page in mvc4?

code:

@Html.TextBoxFor(x => x.PercentNos, new {@class = "percentage-numbers"}) 

How to set the number limit from 0 to 100 in @html.textboxfor on cshtml view page in mvc4?

+4
source share
1 answer

You can use the Range attribute to limit input from 0 to 100. You apply this attribute to the (target) property of the model that you use in your view.

 [Range(0,100)] public int PercentNos { get; set; } 
+6
source

Source: https://habr.com/ru/post/1479316/


All Articles