Export data from Telerik MVC grid or DevExpress MVC extensions Grid
we are evaluating which component library to buy, either Telerik MVC or DevExpress MVC extensions.
we need at minimum:
out of the box grid content export to variou开发者_运维百科s formats (Excel, Pdf, Html...);
in the footer of the grid, when paging is enabled, possibility to show a textbox which accepts input for quick page switching ( I want to enter 25, click enter and go to page 25 without clicking on too many links in the footer );
does anybody have experience with any or both libraries and can tell me if these features are supported by both or any or none?
Thanks!
The DevExpress MVC GridView Extension provides the required functionality:
Exporting Data: http://mvc.devexpress.com/GridView/Export
Customizable Pager: http://mvc.devexpress.com/GridView/Templates
Telerik is very good stuff. Their MVC implementation is brand new and quite good. It is open sourced or for purchase depending upon your own licensing needs. Even under a license it is nice to read their source code. It helps you use it smarter.
Using the modern light weight AJAX approach, the grid will only have some of the rows loaded and export from such a client side grid makes no sense. If there are ten rows displayed and pagination shows page i of j then an explicit export from the client side grid will only get ten rows.
Consider creating a new controller method like this:
public ActionResult ExportToExcel()
{
byte[] csvData = null; //... fetch the data from your repository and convert to CSV
return File(csvData, "text/csv", "data.csv");
}
精彩评论