0
我有一个kendo组合框,我有一个基诺html.checkboxfor控制。我需要使复选框启用true或false基于从combox选定的文本值我使用下面的代码,但它不适合我。我需要一些建议。使html.checkboxfor启用真假
<tr>
<td>Status Reason</td>
<td>
<div id="options">
@(Html.Kendo().ComboBox()
.Name("StatusReasons")
.Placeholder("Select Status...")
.BindTo(Model.StatusReason)
.DataTextField("statusName")
.DataValueField("statusIndex")
.SelectedIndex(Convert.ToInt32(Model.StatusReasonID) - 1)
.Events(e => e.Select("enableButton"))
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetStatusReasons", "Home");
});
})
.Suggest(true)
.HtmlAttributes(Model.Editable ? new { tabindex = "2" } : (object)new { style = "width:200px", /*disabled = "disabled",*/ tabindex = "2" })
)
</div>
</td>
<td>
Name: @Html.CheckBoxFor(model => model.Name, new { disabled = true, value = "false" })
</td>
<td>
Name 2: @Html.CheckBoxFor(model => model.ReissueDeduction, new { disabled = true, value = "false" })
</td>
</tr>
function enableButton(e)
{
if (e.item) {
var dataItem = this.dataItem(e.item.index());
if (dataItem.statusName == 'Reissue')
{
//make check box enable
} else {
//make check box disable
}
}
}
Refered这是解决不了问题,我need.I唤醒,使checkboxfor启用或禁用@sleeyuen –
OK,所以真正的问题在于启用/禁用复选框?因为你只提供了启用/禁用的评论,所以我认为你已经覆盖了这个问题,并且问题在于访问组合框的文本。请确认@RohilPatel – sleeyuen
实际问题是启用/禁用控件的复选框@sleeyuen –