We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Export Data without using grid

Can i use the export to excel feature without using the grid control.

I notice the grid will perform a POST. with json information. Can I simply call ExportToExcel action and have the data converted to excel using a static grid method or some sort of technique . I don't need to display the data in the grid to the user,  but i would like to return a formatted excel sheet of a dataset. 

1 Reply

AR Ajith R Syncfusion Team June 10, 2013 12:32 PM UTC

Hi Dimitrios,

                Thanks for using Syncfusion products.

                 We would like to you know that  exporting data without grid  is not possible, as we do internal operation  for exporting  data from grid to excel using Mapping method. So we suggest you to  generate the grid without rendering data and exporting to excel by use the following code snippet.               

            Generating grid without rendering:

public ActionResult Index()

        {

            var data = new MyClassContext().myclass.ToList();

            return View();

        }

        Export to Excel:

        [AcceptVerbs(HttpVerbs.Post)]

        public ActionResult Export(PagingParams args)

        {

            var data = new MyClassContext().myclass.ToList();

            return data.GridExportToExcel<MyClass>("GridExcel.xlsx", ExcelVersion.Excel2007);

        }      

 

       Please refer to the following link to download the sample.                    

            Please get back us if you have any other concerns.               

Regards

Ajith R

 



ExcelExport_1d6c924d.zip

Loader.
Live Chat Icon For mobile
Up arrow icon