This is a migrated thread and some comments may be shown as answers.

Foreign key dropdown with multiple columns

2 Answers 160 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 24 May 2016, 10:18 PM

I have a grid with a foreign key that is displaying a dropdown in in-line edit mode. That's working fine but I would like to display multiple columns from the parent object in that dropdown not just the key as it currently does. How do I configure for that?

Here's what I have

    @(Html.Kendo().Grid<MBSData.Model.DocumentType>()
          .Name("documenttypegrid")
          .HtmlAttributes(new {style = "height:600px;"})
          .Columns(columns =>
          {
              columns.Bound(c => c.DocumentTypeId).Title("Type").Width("120px");
              columns.ForeignKey(p => p.DocumentCategoryId, (System.Collections.IEnumerable) ViewData["DocumentCategories"], "DocumentCategoryId", "DocumentCategoryId")
                  .Title("Category")
                  .Width("120px");
              columns.Bound(c => c.Description);
              columns.Command(command =>
              {
                  command.Edit();
                  command.Destroy();
              }).Width("190px");
          })
          .ToolBar(toolbar => { toolbar.Create(); })
          .Editable(editable => editable.Mode(GridEditMode.InLine))
          .Sortable(sortable => { sortable.SortMode(GridSortMode.MultipleColumn); })
          .Filterable()
          .Scrollable(s => s.Height("auto"))
          .Resizable(resize => resize.Columns(true))
          .DataSource(dataSource => dataSource
              .Ajax()
              .ServerOperation(false)
              .Model(model => model.Id(p => p.DocumentTypeId))
              .Read(read => read.Action("DocumentType_Read", "DocumentType"))
              .Create(create => create.Action("DocumentType_Create", "DocumentType"))
              .Update(update => update.Action("DocumentType_Update", "DocumentType"))
              .Destroy(destroy => destroy.Action("DocumentType_Destroy", "DocumentType"))
          )
          .Events(events => events
              .Edit("onEdit")
          )
          )

 

Thanks.

Tom

2 Answers, 1 is accepted

Sort by
0
Accepted
Eyup
Telerik team
answered on 26 May 2016, 03:44 PM
Hello Tom,

I've already replied to your ticket with ID: 1037521. I suggest that we continue our conversation on the mentioned thread.

Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Tom
Top achievements
Rank 1
answered on 26 May 2016, 03:46 PM
Yes, thank you.
Tags
Grid
Asked by
Tom
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Tom
Top achievements
Rank 1
Share this question
or