Try this. Make the name of the field according to your model field to bind the input field to the model property.
<input type="text" name='SkillSets[@j].Cost' placeholder="Cost per hour" class = "input_newmainbg" />
سؤال
I want to show placeholder value in text box if Model Cost value is '0', but it's showing default '0'. What is incorrect in the following code?
<div class="leftflotdiv">
@if (Model.SkillSets[j].Cost > 0)
{
@Html.TextBoxFor(x => x.SkillSets[j].Cost, new { @class = "input_newmainbg", placeholder = "Cost per hour", Value = Model.SkillSets[j].Cost })
}
else
{
@Model.SkillSets[j].Cost
@Html.TextBoxFor(x => x.SkillSets[j].Cost, new { @class = "input_newmainbg", placeholder = "Cost per hour" })
}
</div>
المحلول
Try this. Make the name of the field according to your model field to bind the input field to the model property.
<input type="text" name='SkillSets[@j].Cost' placeholder="Cost per hour" class = "input_newmainbg" />