小编Kev*_*orz的帖子

ASP .NET MVC如何使用@ Html.EditorFor增加输入字段的宽度

我只是无法修复看起来那么容易的东西.我想要一个模型属性的文本框(editorfor),我想增加它的宽度,但没有发生任何事情.我正在使用下面列出的代码.我尝试将宽度设置为500px,但没有任何反应.理想情况下,我希望文本框伸展到容器的整个宽度.有任何想法吗?

@if (Model.isAnswerVisible)
    {
        <div class="form-group">
            <div class="col-md-10">
                <div class="input-group">
                    <span class="input-group-addon">@Model.AreaNameAnswer</span>
                    @Html.EditorFor(model => model.Answer, new { htmlAttributes = new { id = "answer", style = "width: 500px", onkeyup = "limitCharacters()", @class = "form-control" } })
                </div>

                @Html.ValidationMessageFor(model => model.Answer, "", new { @class = "text-danger" })
                <span class="glyphicon glyphicon-question-sign" aria-hidden="true" title="Leg kort uit wat jouw antwoord is op de vraag"></span>
                <label id="lblCountAnswer" style="color: green">@Model.MaxTokensAnswer</label>
            </div>
        </div>
    }
Run Code Online (Sandbox Code Playgroud)

html css c# asp.net asp.net-mvc

4
推荐指数
1
解决办法
3927
查看次数

标签 统计

asp.net ×1

asp.net-mvc ×1

c# ×1

css ×1

html ×1