Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在asp.net文本框的左右两侧添加标签_C#_Asp.net Mvc_Twitter Bootstrap - Fatal编程技术网

C# 如何在asp.net文本框的左右两侧添加标签

C# 如何在asp.net文本框的左右两侧添加标签,c#,asp.net-mvc,twitter-bootstrap,C#,Asp.net Mvc,Twitter Bootstrap,我尝试在文本框的右侧添加标签,以包含值的单位 和 这是我的密码 <div class="form-group "> @Html.LabelFor(model => model.files, htmlAttributes: new { @class = "control-label col-md-3" }) <div class="col-md-8">

我尝试在文本框的右侧添加标签,以包含值的单位

这是我的密码

    <div class="form-group ">

                    @Html.LabelFor(model => model.files, htmlAttributes: new { @class = "control-label col-md-3" })
                    <div class="col-md-8">
                        @{ Html.EnableClientValidation(false); }

                        @Html.EditorFor(model => model.files, new { htmlAttributes = new { @class = "form-control " } })<span>GB</span>
                        @{ Html.EnableClientValidation(true); }
                        @Html.ValidationMessageFor(model => model.files, "", new { @class = "text-danger" })

                    </div>
                </div>

@LabelFor(model=>model.files,htmlAttributes:new{@class=“controllabel col-md-3”})
@{Html.EnableClientValidation(false);}
@EditorFor(model=>model.files,new{htmlAttributes=new{@class=“form control”})GB
@{Html.EnableClientValidation(true);}
@Html.ValidationMessageFor(model=>model.files,“,new{@class=“text danger”})
谢谢。

class=“col-md-8”包含位置:相对。 因为此行有class=“form control”,而您的GB没有类。它回到了它的自然位置。添加一个类应该告诉它去哪里

@Html.EditorFor(model => model.files, new { htmlAttributes = new { @class = "form-control col-md-11" } })<span class="col-md-1">GB</span>
@Html.EditorFor(model=>model.files,new{htmlAttributes=new{@class=“form control col-md-11”})GB

in simply,您可以尝试将两个控件放在单独的span标记中,即@Html.EditorFor(model=>model.files,new{htmlAttributes=new{@class=“form control”})GB希望它能工作不确定,请告诉我它是否工作,谢谢