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

Passing additional info when binding grid

1 Answer 105 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michele
Top achievements
Rank 2
Michele asked on 03 Sep 2013, 05:08 AM
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

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 04 Sep 2013, 11:06 AM
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!
Tags
Grid
Asked by
Michele
Top achievements
Rank 2
Answers by
Petur Subev
Telerik team
Share this question
or