I'm new to RegularExpression in asp.net MVC 2. It's been whole day looking for the right syntax trial and error.
If anyone could help?
Here is the problem:
minimum hours work/day -> allowable float number but not greater than 24
minimum hours work/week -> allowable float number but not greater than 56
I'm trying to create regex that will accept if the input is integer or float number but not greater than 24.
Also if the input has white space print ErrorMessage = " White space is not allowed"
VIEW
<td>
<%= Html.TextBoxFor(model => model.dblMinHrs, new { @class = "txtInput"})%>
<%= Html.ValidationMessageFor(model => model.dblMinHrs)%>
</td>
<td>
<%= Html.TextBoxFor(model => model.dblMinWk, new { @class = "txtInput"})%>
<%= Html.ValidationMessageFor(model => model.dblMinWk)%>
</td>
MODEL
[RegularExpression("([0-1]\\d{0,1})|(2[0-4])", ErrorMessage = "Must not greater than 24")]
public double dblMinHrs { get; set; }
[RegularExpression("([0-4]\d{0,1})|(5[0-6])", ErrorMessage = "Must not greater than 24")]
public double dblMinWk { get; set; }
Anyone please help.