This is a migrated thread and some comments may be shown as answers.

There is no DataSource Model Id property specified.

13 Answers 5424 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michel
Top achievements
Rank 1
Michel asked on 06 Jul 2012, 06:00 AM
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.

13 Answers, 1 is accepted

Sort by
1
Accepted
MattL
Top achievements
Rank 1
answered on 07 Jul 2012, 02:36 PM

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))
        )
        
)
0
Justin
Top achievements
Rank 1
answered on 07 Oct 2014, 08:49 AM
Thanks a lot.
0
Vineet
Top achievements
Rank 1
answered on 08 Sep 2015, 02:00 AM
Thanks for sharing.
0
hoa
Top achievements
Rank 1
answered on 04 Nov 2015, 01:48 AM
thanks for share.
0
Richard
Top achievements
Rank 1
answered on 17 Nov 2016, 04:32 PM
Thanks!
0
jano
Top achievements
Rank 1
answered on 09 Nov 2018, 02:50 PM
THANKS for You & Google ;-) in 2018 year !!!
0
Konstantin Dikov
Telerik team
answered on 14 Nov 2018, 11:59 AM
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.
0
Marcus
Top achievements
Rank 2
answered on 06 Jun 2019, 03:59 PM
Still helpful! ;)
0
Taffy Lewis
Top achievements
Rank 1
answered on 23 Oct 2019, 11:24 AM

Worked 3 years ago, worked for me today! 

 

Thanks!

0
Mike
Top achievements
Rank 1
answered on 06 Mar 2020, 07:05 PM
Works in 2020
0
David
Top achievements
Rank 1
answered on 12 Feb 2021, 01:08 AM

Still working in 2021 also.

 

Thanks!

Paul
Top achievements
Rank 1
Iron
commented on 20 Mar 2025, 02:23 PM

Thanks for this from 2025
0
Paul
Top achievements
Rank 1
Iron
answered on 20 Mar 2025, 02:23 PM
Thanks for this from 2025
0
ann
Top achievements
Rank 1
Iron
answered on 14 Sep 2025, 12:43 PM
where PROPERTY is an attribute of the model object. What is the proper model definition syntax?If the model is a system, then Id.Information.DataTable, and the DataTable's Id field is TableId For details?
Neli
Telerik team
commented on 17 Sep 2025, 01:18 PM

Hello Ann,

To define the model for a Kendo UI DataSource when the unique identifier is nested inside your data structure, you should specify the full property path using dot notation in the model.id field.

Proper Syntax for Nested ID Property

If your data structure looks like this:

{
  "Id": {
    "Information": {
      "DataTable": {
        "TableId": 123
      }
    }
  },
  // other properties...
}

You should configure your DataSource schema as follows:

schema: {
    model: {
        id: "Id.Information.DataTable.TableId",
        fields: {
            // Define other fields here as needed
        }
    }
}

This tells the DataSource to use the TableId inside the nested object as the unique identifier.

MVC Wrapper Example

For the MVC wrappers, the syntax is similar:

.Model(model => {
    model.Id(p => p.Id.Information.DataTable.TableId);
    // Define other fields here
})

    Regards,
    Neli
    Progress Telerik

    Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

    Tags
    Grid
    Asked by
    Michel
    Top achievements
    Rank 1
    Answers by
    MattL
    Top achievements
    Rank 1
    Justin
    Top achievements
    Rank 1
    Vineet
    Top achievements
    Rank 1
    hoa
    Top achievements
    Rank 1
    Richard
    Top achievements
    Rank 1
    jano
    Top achievements
    Rank 1
    Konstantin Dikov
    Telerik team
    Marcus
    Top achievements
    Rank 2
    Taffy Lewis
    Top achievements
    Rank 1
    Mike
    Top achievements
    Rank 1
    David
    Top achievements
    Rank 1
    Paul
    Top achievements
    Rank 1
    Iron
    ann
    Top achievements
    Rank 1
    Iron
    Share this question
    or