public static MvcHtmlString NumberEditorFor <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, object htmlAttributes = null)
        {
            ModelMetadata metadata = ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData);

            IDictionary <string, object> attributes = ToAttributesDictionary(htmlAttributes);
            RangeAttribute rangeAttribute           = AttributesHelper.GetAttribute <RangeAttribute>(metadata.ContainerType, metadata.PropertyName);

            if (rangeAttribute != null)
            {
                attributes.Add("type", "number");
                attributes.Add("min", rangeAttribute.Minimum);
                attributes.Add("max", rangeAttribute.Maximum);
            }

            return(htmlHelper.TextBoxFor(expression, attributes));
        }