views:

47

answers:

2

I would like to control how many characters users can write in TextAreaFor.

How can I do it, with a remaining counter if characters under the textarea??

My TextAreaFor looks like that:

<%= Html.TextAreaFor(m => m.Answer,7,72,null) %>
+1  A: 

You need to use javascript in order to achieve this or if you prefer jQuery.

Darin Dimitrov
+1  A: 

It is not the control itself. You just can't do that with a textarea. I found this weirder in webforms when you can on <asp:TextBox but not on <asp:TextBox Mode="MultiLine"

Anyway, it is just HTML's problem not ASP.NET MVC's. You will need JavaScript (or make it a TextBox)

BritishDeveloper