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希望它能工作不确定,请告诉我它是否工作,谢谢