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

There is no DataSource Model Id property specified.

11 Answers 4754 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.

11 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!

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
Share this question
or