Foreign key dropdown with multiple columns

3 posts, 1 answers
  1. Tom
    Tom avatar
    2 posts
    Member since:
    May 2016

    Posted 24 May Link to this post

    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. Answer
    Eyup
    Admin
    Eyup avatar
    3012 posts

    Posted 26 May Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Tom
    Tom avatar
    2 posts
    Member since:
    May 2016

    Posted 26 May in reply to Eyup Link to this post

    Yes, thank you.
Back to Top