0
votes

When I set the selected item in the Kendo ComboBox, it will display the Value and not the Text of the Item.

 foreach (var v in Model.Projects)
  {
    SelectListItem item = new SelectListItem();
    item.Value = v.Project_Id;
    item.Text = v.Description;

    if (v.Project_Id.Equals(Model.Project_Id))
    {
      item.Selected = true;
    }
    list.Add(item);
  }

            }

            @(Html.Kendo().ComboBox()
              .Name("mycombo")
              .BindTo(list)
              .Enable(true)
              .AutoBind(false)

    )
2

2 Answers

2
votes

Try updating your ComboBox wrapper with the DataTextField and DataValueField to tell it specifically what fields to use.

@(Html.Kendo().ComboBox()
              .Name("mycombo")
              .BindTo(list)
              .Enable(true)
              .DataTextField("Text")
              .DataValueField("Value")
              .AutoBind(false))
0
votes

Just need to set the auto bind to true, so the text would be loaded immediately and not only when the user clicked the combo box.

@(Html.Kendo().ComboBox()
              .Name("mycombo")
              .BindTo(list)
              .Enable(true)
              .AutoBind(true)