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

Is it possible to Bind Spreadsheet to IEnumerable<MyClass>

3 Answers 116 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 2
William asked on 29 Mar 2016, 10:14 PM

Is it possible to bind the Spreadsheet to IEnumerable<MyClass> where the property names would be the columns of the sheet and each item of the IEnumerable object would be a row in the sheet? 

        public class MyClass
        {
            public int Id { get; set; }
            public string FirstName { get; set; }
            public string LastName { get; set; }
        }

        var myObject = new List<MyClass>()
        {
           new MyClass() {Id = 1,FirstName = "Lucas",LastName = "Green"},
           new MyClass() {Id = 2,FirstName = "Eva",LastName = "Black"},
           new MyClass() {Id = 3,FirstName = "Miroslava",LastName = "Brown"},
        };

Output:
Id  FirstName   LastName
1   Lukas          Green
2   Eva             Black
3   Miroslava    Brown

3 Answers, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 01 Apr 2016, 08:10 AM
Hello William,

You can bind the Kendo UI Spreadsheet to a collection of a given type, using a DataSource. Currently there is no Razor syntax for a Spreadsheet DataSource configuration, but one is in production, and will be available in next week's service pack release.

Meanwhile you can check out the following demo, showing how to bind a Spreadsheet to a dataDource:

http://demos.telerik.com/kendo-ui/spreadsheet/datasource

I hope this helps.

Regards,
Dimiter Topalov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Scott
Top achievements
Rank 1
answered on 02 Aug 2016, 03:29 PM
Has the razor syntax for the spreadsheet DataSource configuration been released yet?    Running v.2016.1.112
0
Dimiter Topalov
Telerik team
answered on 04 Aug 2016, 08:22 AM
Hi Scott,

It is released and available in our current official version (2016.2.714):

http://demos.telerik.com/aspnet-mvc/spreadsheet/datasource

The demo is also available in the sample application:

http://docs.telerik.com/kendo-ui/aspnet-mvc/introduction#sample-application

Regards,
Dimiter Topalov
Telerik by Progress
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Tags
Spreadsheet
Asked by
William
Top achievements
Rank 2
Answers by
Dimiter Topalov
Telerik team
Scott
Top achievements
Rank 1
Share this question
or