I am using the DropDownList control for kendo UI, how can we set the default value for DropDownList?
I have a property of the selected list in the viewmodel as shown below:
public SelectList AuditTypes { get; set; }
Then in the controller I populate the selected list and set its default value
viewModel.AuditTypes = new SelectList(dropdownDetails, "Value", "Text", dropdownDetails.Where(x => x.Default == true));
and in my razor mode I have the following code:
@(Html.Kendo().DropDownList() .Name("AuditType") .DataTextField("Text") .DataValueField("Value") .BindTo(Model.AuditTypes) .AutoBind(true)
The problem is that the default value is not set.
kendo-ui kendo-dropdown
user2206329
source share