似乎ASP NET MVC在使用TextAreaFor时无法正确显示。有没有人有这个问题?

This is how the browser is displaying it

请注意,最后一个TextArea正在显示。

This is how the code is my code

请注意,红色矩形下方的TextArea显示得很好。

回答

    textarea
    {
        display: block;
        width: 100%;
        height: 34px;
        padding: 6px 12px;
        font-size: 14px;
        line-height: 1.428571429;
        color: #555555;
        vertical-align: middle;
        background-color: #ffffff;
        border: 1px solid #cccccc;
        border-radius: 4px;
        -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
        box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
        -webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out
         0.15s;
        transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
    }

最佳答案

我认为您输入了TextAreaFor:

@Html.TextAreaFor(model => model.Titulo, new { htmlAttributes = new { @class = "form-control" } })


应该

@Html.TextAreaFor(model => model.Titulo, htmlAttributes: new { @class = "form-control" } )


甚至

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

09-25 16:48