i am using Kendo DropdownList with ajax binding.
With these codes i cannot set inital value that coming from model.It just fill the list with items and selects the first item.
@(Html.Kendo().DropDownList()
.Name("NATIONALITY")
.DataTextField("DESCRIPTION").HtmlAttributes(new { style = "width:220px" })
.DataValueField("REFERENCEID")
.Value(Model.NATIONALITY)
//Placeholder("SELECT")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetDefinitionDetails", "Definition", new { definitionCode = "NATIONALITY", addEmptyRow = false });
}).ServerFiltering(true);
}).ServerFiltering(true);
}))
But When i change Html.Kendo().DropDownList() to Html.Kendo().Combobox() it also fills the list and set the initial value as expected(which is the value that passing by model.)
With the latest(maybe works on earlier versions) build of KendoUI , initial Text value can be set on dropdowns:
....
.Value(Model.DOCTORCODE.ToString()) //DOCTORCODE is guid type
.Text(Model.DOCTOR) //DOCTOR is string type.This is optional.It should work without .Text property