In my view model I have a nullable decimal field that is not required, but if a value is entered, it must be within a specified range:
If I use either of the following approaches in my view and don't enter any values into the field, the range rule triggers and prevents submission:
This is the HTML rendered by the @Html.TextBoxFor(...)
I'm just wondering if I'm doing something wrong or is that the intended behavior?
Thanks
[Range(0.01, 1.00)]public decimal? Percentile { get; set; }If I use either of the following approaches in my view and don't enter any values into the field, the range rule triggers and prevents submission:
@Html.TextBoxFor(m => m.Percentile, new { @class = "k-textbox k-input" }) @Html.Kendo().NumericTextBoxFor(m => m.Percentile)This is the HTML rendered by the @Html.TextBoxFor(...)
<input id="AllGuidelines_0__Percentile" class="k-textbox k-input" type="text" value="" name="AllGuidelines[0].Percentile" data-val-range-min="0.01" data-val-range-max="1" data-val-range="The field Percentile must be between 0.01 and 1." data-val-number="The field Starting Percentile must be a number." data-val="true">I'm just wondering if I'm doing something wrong or is that the intended behavior?
Thanks