3

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);
    }
Ian Vink
  • 66,960
  • 104
  • 341
  • 555
  • Not very familiar with Kendo ComboBox, but can you set the `.text` property to display the initial value? something like `.text(Model.Name)` –  Sep 13 '14 at 01:06
  • Any answers found on this one? I do have the same problem – Bcelik Nov 04 '14 at 12:11

0 Answers0