kendo combobox reset after loading back view from controller

两盒软妹~` 提交于 2019-12-13 08:08:06

问题


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);


来源:https://stackoverflow.com/questions/24522401/kendo-combobox-reset-after-loading-back-view-from-controller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!