1
votes

ASP.Net MVC 3, Kendo UI Web, Kendo grid control.

My main datasource uses foreign datasource via foreign key binding:

.Columns(columns =>
{
    columns.ForeignKey(p => p.FK_ID, (System.Collections.IEnumerable)ViewData["things"], "ID", "NAME");
    ...

In view mode, binding works as expected, I see NAME property bound by "FK_ID - ID" relation.

However when I enter edit mode strange things happen:

  • in inline mode -- the column is disabled (i.e. there is no editor for this field of any kind)

  • in popup mode -- there is an editbox editor, not combobox, so I have to type it manually despite the fact of binding

On the Kendo website the demo shows, that in case of foreign keys in edit mode, combobox is shown and the choice is limited to the foreign datasource (pretty common sense).

So what should I do additionally to show combobox and choose only from the values shown there?

1

1 Answers

3
votes

Could you please check whether you have the foreign key editor which is required? It should be under the Views/Shared/EditorTemplates folder and its name is GridForeignKey.cshtml (or .aspx if using ASPX view engine)

If it is not there you can add it by hand using the info from above. The content of the editor is:

@( Html.Kendo().DropDownList()
    .Name(ViewData.TemplateInfo.GetFullHtmlFieldName(""))
    .BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"]))