HTML 5 Input of type Range and of Input of type Numeric


@Html.RangeFor(m => m.Percentages[index], new { style = "text-align:right", min=0d, max=100d })

@Html.InputNumberFor(m => m.Percentages[index], new { style = "text-align:right", min=0d, max=100d })


If min and or max are not provided as attributes, their value is taken from validation attributes, if any. Also dynamic minimum or maximum are taken (see DynamicRangeAttribute) if their values can be computed on the server side before rendering the control. This feature works JUST if unobtrusive validation is turned on.

if the min and max are provided explicitely they override the values provided by the validation attributes.

Other Html5 inputs can be obtained by simply using a TextBox or TextBoxFor helper and providing the right type attribute.

Last edited Jun 22, 2014 at 11:57 AM by frankabbruzzese, version 11


No comments yet.