Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
25
Exporting a Grid that uses Paging - What Did I Miss?
posted

I found a workaround for this problem Here, but I'm wondering how I missed this problem in the documentation. Here's the problem. A simple grid with paging turned on and more than one page of data in it. When Export is executed, only the visible page is exported.

So, this isn't so much a question about the functionality, as I believe I can live with the workaround. The question is - how did I mis this in the documentation, because it leaves me wondering what else I missed?

-----------------------------------------------------

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestGrid.aspx.cs" Inherits="Reports.TestGrid" %>

 

<%@ Register Assembly="Infragistics35.WebUI.UltraWebGrid.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"

    Namespace="Infragistics.WebUI.UltraWebGrid" TagPrefix="igtbl" %>

<%@ Register Assembly="Infragistics35.WebUI.UltraWebGrid.ExcelExport.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"

    Namespace="Infragistics.WebUI.UltraWebGrid.ExcelExport" TagPrefix="igtblexp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>Untitled Page</title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <asp:Button ID="btnDownload" runat="server" Text="Download" OnClick="btnDownload_Click" />

        <igtblexp:UltraWebGridExcelExporter ID="UltraWebGridExcelExporter1" runat='server' />

        <igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server">

            <DisplayLayout>

                <Pager Alignment="Center" AllowPaging="True" PagerAppearance="Both" StyleMode="Numeric"/>

            </DisplayLayout>

        </igtbl:UltraWebGrid>

    </div>

    </form>

</body>

</html>

 

using System;

using System.Web.UI;

using Infragistics.WebUI.UltraWebGrid;

using Infragistics.WebUI.UltraWebGrid.ExcelExport;

 

namespace Reports

{

    public partial class TestGrid : Page

    {

        protected void Page_Load(object sender, EventArgs e)

        {

            var ds = MakeDataSet();

            UltraWebGrid1.DataSource = ds.Summary;

            UltraWebGrid1.DataBind();

        }

 

        protected void btnDownload_Click(object sender, EventArgs e)

        {

            var ds = MakeDataSet();

            var uwg = new UltraWebGrid {ID = "uwg", DataSource = ds.Summary};

            uwg.DataBind();

 

            var uwgee = new UltraWebGridExcelExporter();

            Controls.Add(uwgee);

 

            uwgee.ExportMode = ExportMode.Download;

            uwgee.Export(uwg);

            // This is what doesn't work: UltraWebGridExcelExporter1.Export(UltraWebGrid1);

        }

 

        private static SummaryDataSet MakeDataSet()

        {

            var ds = new SummaryDataSet();

            for (var i = 0; i < 100; i++)

            {

                var row = ds.Summary.NewSummaryRow();

                row.Fixed = "Fixed " + i;

                for (var j = 1; j <= 12; j++)

                {

                    row[j.ToString()] = j;

                }

                ds.Summary.AddSummaryRow(row);

            }

            return ds;

        }

    }

}

 

 

 

  • 28464
    posted

    Hello,

    Yes,  this is indeed valuable feedback for us. We are trying to update the documentation with everything we can think of before we release a product, but of course there are always scenarios that come up.That is why we come up with community sites like this one, with resources like KB, DevCenter, etc.

    Other common issues that you might need to know while exporting - AJAX. File exporting is essentially a file download operation which is not supported in AJAX enablers like Microsoft's UpdatePanel or our own Infragistics WebAsyncRefreshPanel. The workaround is to exclude the button intiating the export -- either place it outside the UpdatePanel or exclude it using PostBackTriggers.

    Of course -- if you have any questions -- just let us know. We will gladly answer any questions you might have.