How can i add dollar symbol to the mvc value
@Html.TextBoxFor(x => x.RefundAmount, new { @class = "form-control", id = "RefundAmount", name = "RefundAmount",disabled="disabled" })
How can i add dollar symbol to the mvc value
@Html.TextBoxFor(x => x.RefundAmount, new { @class = "form-control", id = "RefundAmount", name = "RefundAmount",disabled="disabled" })
@Html.TextBoxFor(model => model.RefundAmount, new { @class = "required numeric", Value=String.Format("$ {0}",Model.RefundAmount) })
Try this
@Html.TextBoxFor(x => "$"+x.RefundAmount, new { @class = "form-control", id = "RefundAmount", name = "RefundAmount",disabled="disabled" })
Try this above code
Add to view : *put $ sign between i tags
<div class="input-icon">
@Html.EditorFor(model => model.Sample,new {htmlAttributes = new { @class ="txt form control"} })
<i>$</i> ($ sign between the i tags)
</div>
@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;
}
for more details check link here