Who can help me. When loading data to a mvc view, i'll load the value of the checkbox, but if true, i'll need to disable 2 textbox fields.
Code is a piece of my for loop
@Html.TextBoxFor(m => m.Items[i].StartIntervalTime, "{0:HH:mm}", new {
Value = Model.Items[i].Available ? "" : Model.Items[i].StartIntervalTime.ToString("HH:mm"),
id = "startTime" + i
})
<span>untill</span>
@Html.TextBoxFor(m => m.Items[i].EndIntervalTime, "{0:HH:mm}", new {
Value = Model.Items[i].Available ? "" : Model.Items[i].EndIntervalTime.ToString("HH:mm"),
id = "endTime" + i
})
@Html.CheckBoxFor(m => m.Items[i].Available, new { id = i, @class = "closedallday" })
I've tried, in the textbox tag, with "disabled" like i did with "value", but disabled will always disables the textbox even without a value. So..
Disabled = Model.Items[i].Available ? "disabled" : "",
I need a real working solution.
Thank you Dinand
Disabled = Model.Items[i].Available ? "disabled" : "",? Have you tried with lowercasedisabledfield instead?jQuery?