I want to dynamically disable/enable textbox aftre clicking the checkbox. How can I do it? I'm using this:
@{
object addInput = (Model.AddInput) ? null : new { disabled = "disabled" };
}
@Html.CheckBoxFor(model=> model.AddInput)
@Html.TextBoxFor(model => model.Input.Name, addInput)
but it works only on start. Clicking the checkbox isn't changing anything. How can do some binding to change disable state automaticaly?
This needs to be done in javascript.
Add jquery action on click on your checkbox and set state appropriately.
In case you want to enable it for some reason, you can also use the following: