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

Export RadGrid to Excel

1 Answer 32 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Atif
Top achievements
Rank 1
Atif asked on 02 Jul 2015, 08:22 AM

I am Exporting RadGrid with aprox 40000 records to excel. But only 100 records are showing in Excel file. which is record of first 10 Pages in RadGrid. Here's my code.

 

protected void ImageButton_Click(object sender, ImageClickEventArgs e)
    {
        RadGrid1.ExportSettings.Excel.Format = GridExcelExportFormat.Html;
        RadGrid1.ExportSettings.IgnorePaging = true;
        RadGrid1.DataBind();
        
        RadGrid1.ExportSettings.ExportOnlyData = true;
        //RadGrid1.ExportSettings.OpenInNewWindow = true;
        RadGrid1.MasterTableView.ExportToExcel();
    }

 

 

RadGrid :

<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="true" PageSize="10" GridLines="None"   >
            
            <ClientSettings>
                <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                <Virtualization EnableVirtualization="true"  />
            </ClientSettings>
        </telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 06 Jul 2015, 12:40 PM
Hello Atif,

In the provided code the RadGrid control is using simple data binding. We strongly recommend using advanced data binding when exporting data from RadGrid.

Please remove all calls to DataBind() and use the NeedDataSource event or a declarative DataSource control to provide data for RadGrid.


Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Atif
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or