开发者

Default value for textarea

开发者 https://www.devze.com 2023-01-31 06:05 出处:网络
I\'m trying to create a textarea element with a default value with the help of the ASP.NET MVC TextAreaFor method.

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消