Bind spreadsheet data to model?

5 posts, 0 answers
  1. Duke
    Duke avatar
    10 posts
    Member since:
    Dec 2016

    Posted 13 Jan Link to this post

    Hi, I'm trying to use server-side wrappers of the UI Spreadsheet for ASP.NET MVC.  I've looked over the documentation and searched this forum, and I can't find the answer to this question:  is it possible to bind the spreadsheet data to a model passed to a view, in the same manner as it's done for the Grid control?  For example, like the below.

    Thank you!

    example below;

    @(Html.Kendo().Grid(Model) //Bind the Grid to the Model property of the view.
              .Name("Grid")
              .Columns(columns =>
              {
                  columns.Bound(p => p.ProductID);   //Create a column bound to the "ProductID" property
                  columns.Bound(p => p.ProductName); //Create a column bound to the "ProductName" property
                  columns.Bound(p => p.UnitPrice);   //Create a column bound to the "UnitPrice" property
                  columns.Bound(p => p.UnitsInStock);//Create a column bound to the "UnitsInStock" property
              })
             .Pageable() //Enable paging.
        )

     

  2. Anton
    Admin
    Anton avatar
    81 posts

    Posted 17 Jan Link to this post

    Hello Duke,

    The Kendo UI Spreadsheet for MVC does not support model binding in the same manner as the Kendo UI Grid for MVC. Our Spreadsheet / DataSource binding demo shows how to bind a sheet's datа source to a View Model.

    Regards,
    Anton
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Duke
    Duke avatar
    10 posts
    Member since:
    Dec 2016

    Posted 17 Jan in reply to Anton Link to this post

        Thanks, Anton.  So to summarize, are the two approaches to loading/saving data:  1) the Datasource Binding method you've referenced above, and 2) using my own front-end JSON and Ajax calls?

    Thanks again.

  4. Duke
    Duke avatar
    10 posts
    Member since:
    Dec 2016

    Posted 18 Jan in reply to Anton Link to this post

    Hi Anton,

    As a followup question, after seeing the demo you pointed out here: https://demos.telerik.com/aspnet-mvc/spreadsheet/datasource, can you tell me where the libraries for the namespace Kendo.Mvc.Examples.Models are from?  I don't see them in anything in VS that  I have available, and therefore can't get the demo to work.

    Thoughts?

    Thanks.

  5. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    357 posts

    Posted 19 Jan Link to this post

    Hello Duke,

    Answering your first question, the Spreadsheet HTML helper, indeed, offers two ways in which it could be populated:

    - Its Sheets could be bound to a DataSource, as shown on the demo discussed. In such case, the DataSource will take care to read and send data from / to the controller; or

    - The Spreadsheet content could be loaded on the client. In such scenario in could be loaded from a JSON, its data could be explicitly set in the HTML helper, or it could be bound to collection of SpreadsheetSheets (as initially configured in the following demo). In all the the above three cases, any changes on the data / Spreadsheet should be manually sent to the server;

    The Kendo.Mvc.Examples.Models namespace is part of the Kendo MVC Examples project, that comes as part of the MVC wrappers suite. If you have a local installation of the Kendo MVC suite, you should be able to find that project on the following location: ​C:\Program Files (x86)\Telerik\UI for ASP.NET MVC R3 2016\wrappers\aspnetmvc\Examples\VS2015

    Regards,
    Veselin Tsvetanov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top