Kendo UI Grid<> columns.ForeignKey datasource

2 posts, 0 answers
  1. John
    John avatar
    9 posts
    Member since:
    Nov 2010

    Posted 14 Nov 2012 Link to this post


    I was trying to create data grid, One column is Dropdownlist.  I want  to pass the dynamic  datasource from the Model. where Model is List<object>  . But the ForeignKey cloumn accepts only SelectList as second parameter. But I want  to make this dynamic i.e model.

    See Below)

    Current Functionality :

      columns.ForeignKey(s => s.FaceId, SelectList)

    I need like   columns.ForeignKey(s => s.FaceId, x => x.FacesList)

    Please suggest me to achieve this  functionality.

  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 20 Nov 2012 Link to this post

    Hello Chris,

    The ForeignKey functionality provide you with the ability to display and edit a foreign key column with a human readable lookup collection instead of working with IDs.
    The only requirement is to pass the collection with the Text/Value pairs at the time you define the Grid - it cannot be dynamically extracted from your model used for the Grid.

    Please notice that your suggestion columns.ForeignKey(s => s.FaceId, x => x.FacesList) would mean that it is possible to have different collection for each record which is not true - same Text/Value pair collection is used for each of the records.

    Kind regards,
    Petur Subev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top