gpt4 book ai didi

razor - MVC5 textarea 行列仅在明确指定而不是通过 htmlAttributes 指定时才起作用

转载 作者:行者123 更新时间:2023-12-01 04:35:40 28 4
gpt4 key购买 nike

@Html.TextAreaFor(model => model.DESCRIPTION, 20, 50, new { htmlAttributes = new { @class = "form-control"} })
问题 :上面的代码正确显示 textarea 的行和列,但下面的代码忽略行/列并显示每个浏览器的默认大小。下面的代码有什么问题?

额外的 new下面的代码是在创建 MVC Entity Framework Controller 时由 VS 自动创建的(如 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"} })

最佳答案

这适用于 MVC 5.2.2:

@Html.TextAreaFor(model => model.Caracteristicas, new { @class = "form-control", @rows = "10" })

关于razor - MVC5 textarea 行列仅在明确指定而不是通过 htmlAttributes 指定时才起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25673799/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com