I'm trying to create a textarea element with a default value with the help of the ASP.NET MVC TextAreaFor method.
<%= Html.TextAreaFor(a => a.Description, new { Class = "gray", rows = "1", cols = "1", @onclick = "clearGray($(this));", Value = "Test sentence" })%>
The box is there, but I don't see the value I set. It appears when inspecting, but not in the textarea. I know you're supposed to set it like <textarea>Test sentence</textarea>
, but I don't know how to do that with the helper method.
I tried using a Co开发者_Go百科ntent attribute, but that didn't work obviously. Any solutions?
Look at ASP.NET MVC - How can I set the Default Value in a Strongly Typed TextArea?
精彩评论