asp.net-corekendo-uikendo-combobox

How to set KendoComboBox( jquery UI) value with ViewModel value?


View(model) is returned from a controller IActionResult method, but Kendo combo-box selected value is not get reflected like other UI elements.

How can I set the selected value of the combo-box with the View model value?


Solution

  • You can set it with the value of KendoComboBox. For example:

    $("#test").kendoComboBox({
        dataTextField: "text",
        dataValueField: "value",
        dataSource: [
            { text: "", value: "1" },
            { text: "", value: "2" },
            { text: "", value: "3" },
        ],
        filter: "contains",
        suggest: true,
        index: -1,
        value: '@Model.yourValue'
    });