How can I select rows in a KendoUI Grid when the datakeys come from several fields?

2 posts, 0 answers
  1. Patrick
    Patrick avatar
    34 posts
    Member since:
    Oct 2011

    Posted 05 Jul 2012 Link to this post

    I have a database table where the primary key is a combination of several fields:

    Field1, Field2, Field3

    If it was just one field (Field1) I could use 

    .DataSource(dataSource => dataSource
    .Model(model => model.Id(p => p.Field1))

    but how do I set the datakeys/model id when there are several fields?

    (If I set the grid to be .Selectable and if I don't set the model id, I get an error message saying that the DataKeys aren't set.)

  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 09 Jul 2012 Link to this post

    Hi Patrick,

    You need to specify some property of the model as Id - if it is not unique it will not affect the Selectable functionality working properly although there might be issues when editing.

    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