There is no DataSource Model Id property specified.

12 posts, 1 answers
  1. Michel
    Michel avatar
    4 posts
    Member since:
    Jul 2012

    Posted 06 Jul 2012 Link to this post

    Hi,
    I'm new to KendoUI, and I created a grid in a view to list all instances of my model (StopLocation) and it works fine, except when adding the .Selectable() line to enable multiple selection, I get an error: "There is no DataSource Model Id property specified.". Anybody knows how to define id for this grid? Or is there something wrong with .Selectable() syntax below?

    @( Html.Kendo().Grid((IEnumerable<Route.StopLocation>)ViewData["Stops"])
                            .Name("selectedStops")
                            .Columns(columns =>
                            {
                                columns.Bound(p => p.StopNo).Title("Stop No.");
                                columns.Bound(p => p.Id).Title("ID");
                                columns.Bound(p => p.StopLocation).Title("Stop Location");
                            })
       // .Selectable causes NotSupportedException: There is no DataSource Model Id property specified.
                            .Selectable(s => s.Mode(GridSelectionMode.Multiple))
                            )

    Thanks in advance.
  2. Answer
    MattL
    MattL avatar
    7 posts
    Member since:
    May 2007

    Posted 07 Jul 2012 Link to this post

    Just ran into the same issue and I found the solution in the serverediting example for the grid.

    I changed my markup by adding the .Datasource section which has the missing model.ID referred to by the error message.

    @model IEnumerable<TestClass.Models.CompanyModel>
    @(Html.Kendo().Grid(Model)
            .Name("Grid")
            .HtmlAttributes(new { style = "border: 0;" })
            .Columns(columns =>
            {
                columns.Bound(p => p.CompanyID).Groupable(false);
                columns.Bound(p => p.Company);
            })
     
            .Sortable()
            .Filterable()
            .Navigatable()
            .Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple))
            .DataSource(dataSource => dataSource
                .Server()
                .Model(model => model.Id(p => p.CompanyID))
            )
            
    )
  3. Justin
    Justin avatar
    2 posts
    Member since:
    Dec 2013

    Posted 07 Oct 2014 Link to this post

    Thanks a lot.
  4. Vineet
    Vineet avatar
    2 posts
    Member since:
    Jun 2015

    Posted 07 Sep 2015 Link to this post

    Thanks for sharing.
  5. hoa
    hoa avatar
    2 posts
    Member since:
    Nov 2015

    Posted 03 Nov 2015 Link to this post

    thanks for share.
  6. Richard
    Richard avatar
    1 posts
    Member since:
    May 2016

    Posted 17 Nov 2016 Link to this post

    Thanks!
  7. jano
    jano avatar
    1 posts
    Member since:
    Oct 2018

    Posted 09 Nov 2018 Link to this post

    THANKS for You & Google ;-) in 2018 year !!!
  8. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 14 Nov 2018 Link to this post

    Hi Jano,

    It would be nice if there was a post from 2017 as well.


    Regards,
    Konstantin Dikov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  9. Marcus
    Marcus avatar
    30 posts
    Member since:
    Jul 2012

    Posted 06 Jun 2019 Link to this post

    Still helpful! ;)
  10. Taffy Lewis
    Taffy Lewis avatar
    10 posts
    Member since:
    Apr 2019

    Posted 23 Oct 2019 in reply to MattL Link to this post

    Worked 3 years ago, worked for me today! 

     

    Thanks!

  11. Mike
    Mike avatar
    3 posts
    Member since:
    Sep 2019

    Posted 06 Mar 2020 Link to this post

    Works in 2020
  12. David
    David avatar
    1 posts
    Member since:
    Jun 2018

    Posted 11 Feb Link to this post

    Still working in 2021 also.

     

    Thanks!

Back to Top