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

[Solved] Can I export a different dataset to Excel?

3 Answers 225 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Software
Top achievements
Rank 1
Software asked on 07 Jun 2008, 07:50 PM
We have a RadGrid that we use for search results, which we limit to the first 100 hits based on the criteria.  We do this because we want to limit the load on the database, and it encourages our users to narrow down the results by adding more search criteria.  However, we'd like to be able to export the entire dataset to Excel.  Is there a way to run a new query when the export button is clicked and export the resulting dataset?

The way we limit the results is by adding a parameter to the stored procedure that indicates if it's a "QuickSearch" or not.  If not, all records are returned.  So I should be able to run the same search parameters, but change the QuickSearch to false, and that would return the entire dataset (up to 1000 records).  That's what I would like to export.  Is this possible?  Or is there a way to set up the RadGrid paging so that it only retrieves 100 records at a time?

Thanks!

Eddie

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Jun 2008, 07:29 AM
Hi Eddie,

If you need to export the Entire data you have to set the IgnorePaging property to true.

CS:
RadGrid1.ExportSettings.IgnorePaging = true

Exporting tips and tricks

Thanks
Princy.
0
Software
Top achievements
Rank 1
answered on 09 Jun 2008, 02:44 PM
Thanks Princy, I'm aware of the IgnorePaging option, but that's not really what I'm talking about.  I'm not using paging, I'm displaying 100 records in the RadGrid.  But when I export I want to export a much larger dataset, removing the 100 hit limit.  In essence, I would need to re-run the stored procedure and export the results to excel.  Is that possible without loading all the data into another RadGrid?
0
Maria Ilieva
Telerik team
answered on 10 Jun 2008, 04:39 PM
Hi Eddie,

In order to acheive the required functionality you could just add the whole DataSet and Rebind the Grid before the Export command. For example:

protected void Button1_Click(object sender, EventArgs e) 
    quickSearch = false
    RadGrid1.Rebind(); 
    RadGrid1.MasterTableView.ExportToExcel(); 


Kind regards,
Maria Ilieva
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Software
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Software
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or