HTML5 appears to support a new range of input fields for things such as:
- Numbers
- Email addresses
- Colors
- URLs
- Numeric range (via a slider)
- Dates
- Search boxes
Has anyone implemented HtmlHelper
extension methods for ASP.NET MVC that generates these yet? It's possible to do this using an overload that accepts htmlAttributes
, such as:
Html.TextBoxFor(model => model.Foo, new { type="number", min="0", max="100" })
But that's not as nice (or typesafe) as:
Html.NumericInputFor(model => model.Foo, min:0, max:100)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…