Export RadGrid to Excel

2 posts, 0 answers
  1. Atif
    Atif avatar
    18 posts
    Member since:
    Jul 2015

    Posted 02 Jul 2015 Link to this post

    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>

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2342 posts

    Posted 06 Jul 2015 Link to this post

    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
Back to Top