如何将美元符号添加到mvc值
@Html.TextBoxFor(x => x.RefundAmount, new { @class = "form-control", id = "RefundAmount", name = "RefundAmount",disabled="disabled" })
答案 0 :(得分:1)
@Html.TextBoxFor(model => model.RefundAmount, new { @class = "required numeric", Value=String.Format("$ {0}",Model.RefundAmount) })
试试这个
答案 1 :(得分:0)
@Html.TextBoxFor(x => "$"+x.RefundAmount, new { @class = "form-control", id = "RefundAmount", name = "RefundAmount",disabled="disabled" })
试试以上代码
答案 2 :(得分:0)
添加到视图: *在i标签之间放入$符号
@ Html.EditorFor(模型=>模型。示例,新{htmlAttributes =新{@class =“ txt表单控件”}}) $ (i标签之间的$符号) @Html.ValidationMessageFor(model => model.Sample, "", new { @class = "text-danger" })
css:
.input-icon {
position: relative;
}
.input-icon > i {
position: absolute;
display: block;
transform: translate(0, -50%);
top: 50%;
pointer-events: none;
width: 35px;
text-align: center;
font-style: normal;
}
.input-icon > input {
padding-left: 20px;
padding-right: 0;
}
有关更多详细信息,请检查link here