1

I have this code and I want to set Maximum value for TextBox and when user enter a value bigger than max value receive an alert.

<%:Html.TextBox("NumPercoPecal" + item.LkpNamePerfo + "_" + empl.NumPrsnEmply, item.NumScorePerfo, new { id = "NumPercoPecals["+m+"]"})%>

please help me

user519737
  • 11
  • 3

1 Answers1

0

I think there is not a built-in feature for Html.TextBox about setting the maximum value like maxlength attribute. But there are many ways for setting the max value of a textbox.

In Asp.Net MVC 2, you can set your Model's attributes. You can use [Range] attribute for setting the min and max value range for a textbox.

ersegun
  • 71
  • 1
  • 5