There is no DataSource Model Id property specified.

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

    Posted 06 Jul 2012 Link to this post

    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"])
                            .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 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>
            .HtmlAttributes(new { style = "border: 0;" })
            .Columns(columns =>
                columns.Bound(p => p.CompanyID).Groupable(false);
                columns.Bound(p => p.Company);
            .Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple))
            .DataSource(dataSource => dataSource
                .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.
Back to Top