Passing additional info when binding grid

2 posts, 0 answers
  1. Michele
    Michele avatar
    426 posts
    Member since:
    Jun 2009

    Posted 03 Sep 2013 Link to this post

    Hello,
    I'm using KENDO UI grid in mvc4 application and following your tutorial for ajax binding I'm doing something  as

    public ActionResult Products_Read([DataSourceRequest]DataSourceRequest request)
    {
    using (var northwind = new NorthwindEntities())
    {
    IQueryable<Product> products = northwind.Products;
    // Convert the Product entities to ProductViewModel instances
    DataSourceResult result = products.ToDataSourceResult(request, product => new ProductViewModel
    {
    ProductID = product.ProductID,
    ProductName = product.ProductName,
    UnitsInStock = product.UnitsInStock
    });
    return Json(result);
    }
    }

    Now I need to add an export in PDF/csv function... I was wondering since you don't offer it out of the box to store a guid of the retieved data and pass it back to
    the client...at the button click I'll pass this data back to the server and export the data if still present in cache otherwist I'll remake the call...
    now I've tried adding a TempData["guid"] just before the Json(result) but with no luck.. should I change the binding method? and use a pure kendoui grid passing back an object as
    Result { Guid ID {get;set; } IEnumerable<type> DataItems {get;set}} ?

    Thanks
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 04 Sep 2013 Link to this post

    Hello Paolo,

    I am not sure what exactly is the question.  Can you please elaborate?

    Basically exporting to pdf, csv is covered in the code library:

    http://www.kendoui.com/code-library/mvc/grid.aspx

    How to send additional parameters to the server is covered here:

    http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/faq#how-do-i-send-values-to-my-action-method-when-binding-the-grid?

    Kind Regards,
    Petur Subev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top