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?
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?
On
Use .Value(model), see example below. Polyester will be the selected value.
@(Html.Kendo().ComboBox()
.Name("fabric")
.Filter("contains")
.Placeholder("Select fabric...")
.DataTextField("Text")
.DataValueField("Value")
.Value("2")
.BindTo(new List<SelectListItem>() {
new SelectListItem() {
Text = "Cotton", Value = "1"
},
new SelectListItem() {
Text = "Polyester", Value = "2"
},
new SelectListItem() {
Text = "Cotton/Polyester", Value = "3"
}
})
.Suggest(true)
.HtmlAttributes(new { style="width:100%;" })
)
You can set it with the
valueofKendoComboBox. For example: