I want to use the @Html.TextBoxFor for my form. and for this field I want for the field is autofilled or the default value is "IDR" and it's disable or greyed out. I already using it like this
<div >
<div >
@Html.TextBoxFor(m => m.dataKinerjaDebitur.TaksasiNonFakurs, new { @class = "form-control", @Value = "IDR", @placeholder = "IDR", @readonly = "readonly" })
</div>
</div>
the value won't pass into the controller, resulted in null. any help?
CodePudding user response:
in your view keep it as it is now, but put a check in your post action
public ActionResult Post (MyModel model)
{
if (string.IsNullOrEmpty(model.dataKinerjaDebitur.TaksasiNonFakurs))
model.dataKinerjaDebitur.TaksasiNonFakurs="IDR";
}
