我有一个Kendo ComboBox作为可编程ID(人)的EditorTemplate。我通常使用UIHint绑定模型
@Html.Kendo().ComboBoxFor(x=>x.Person.MotherID)
组合效果很好,我可以在服务器上输入和过滤。
问题在于,首次加载表单时,此人的 ID 显示为可见文本,而不是名称。
100万条记录,所以我最初无法将它们全部发送到组合框。
我如何获得组合框,首次渲染时,通过Ajax获取此人的姓名而不显示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);
}