kendo combobox reset after loading back view from

2019-09-20 11:07发布

问题:

I have a kendo combobox

   @(Html.Kendo().ComboBox()
        .Name("ddSystems")
        .Filter("contains")
        .Placeholder("-- Select --")
        .BindTo((IEnumerable<SelectListItem>)ViewBag.systemList)
        )

Onchange, a textbox is loaded in ajax. A submit button posts the textbox value and combobox value to the controller. When I get back to the view, I need ddSystems to be reset to empty. I used

  $('#ddSystems').data('kendoComboBox').value(null)

and

 $('#ddSystems').data('kendoComboBox').text('')

but it always retains the previously selected value. Since I use ajax, this will not display the textbox and I am stuck. Please help.

回答1:

This will clear the combo box and disable it

Google is your best friend....

 var combobox = $("#comboBox").data("kendoComboBox");
 combobox.value();
 combobox.enable(false);