I have a Kendo ComboBox as an EditorTemplate for nullable IDs (people). I bind the model normally with a UIHint
@Html.Kendo().ComboBoxFor(x=>x.Person.MotherID)
The combo works great, I can type and it filters on the server.
The problem is that when the form first loads, the ID of the person appears as the visible text, not the name.
There are 1 million records, so I can't send them all to the combobox initially.
How do I get the combobox, when it first renders, to go get the name of the person via Ajax and not show the ID?
@(Html.Kendo()
.ComboBoxFor(m => m)
.DataTextField("Name")
.DataValueField("Value")
.AutoBind(true)
.ValuePrimitive(true)
.Filter(FilterType.Contains)
.Placeholder(Words.Type_Name)
.MinLength(2)
.DataSource(source =>
source.Read(read =>
read.Action("ReadComboBoxPerson", "Picker", new { area = "" }))
.ServerFiltering(true))
)
MVC:
public ActionResult ReadComboBoxPerson(string text)
{
return Json(_personManager.PersonGetter(text), JsonRequestBehavior.AllowGet);
}