How do you set the MaxLength and Size of a TextBox in MVC 2? There have been a couple of questions asked about this on SO. As a newcomer to MVC I am finding that none of the solutions appear to work - possibly because I am not doing it right.
In any case I am wondering if there are better solutions since the previous questions appear to be asked at a time when MVC 2 was in beta.
It's easy, you just to have extra htmlAtttributes
<%= Html.TextBoxFor(model => model.Member, new { maxlength = "20", width = "15" }) %>
<%= Html.TextBoxFor(model => model.Member, new { maxlength = "20", style = "width:200px;" }) %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With