@Html.TextAreaFor(model => model.DESCRIPTION, 20, 50, new { htmlAttributes = new { @class = "form-control"} })
问题:上述代码可以正确地显示文本区域的行数和列数,但下面的代码却忽略了行/列并根据浏览器显示默认大小。下面的代码哪里出错了?
下面代码中的额外的new
是由VS在创建MVC Entity Framework控制器时自动创建的(如http://www.asp.net/mvc/overview/releases/mvc51-release-notes所述)
@Html.TextAreaFor(model => model.DESCRIPTION, new { htmlAttributes = new { @class = "form-control", @rows="20", @cols="50"} })