我试图弄清楚如何使用给定的语法禁用 Html.Checkbox:
@Html.CheckBox("checkbox_" + Model.QuestionId.ToString(), false,
new Dictionary<string, object> {{ "data-bind", "checked: $root.getResponse(@Model.QuestionId).Value" }})
淘汰码:
self.getResponse = function (questionId) {
var rv = ko.utils.arrayFirst(self.responses(), function (item) { return item.QuestionId == questionId; });
if (rv == null) {
rv = new Response(0, questionId, self.evaluationId, 0, 0, '', ''); self.responses.push(rv);
}
return rv;
}
请帮忙