Question

I am using ultrawebgrid v11.1 with xml LoadOnDemand and paging enabled to load more than 100,000 records.

I'd written BindGrid() functionality inside the InitializeDataSource event.

In every postback(Save,ExcelExport,Load..) and/or partial postback(Page navigation,Sorting,filtering..), I am fetching more than 100,000 records from the database and setting the Grid's DataSource.

Issue 1:

Each time querying large amount of data from database is taking more time. Is there a way to query for the data only once on load and subsequently when the data in the grid is modified.

Issue 2:

I am using UltrawebgridExcelExporter v11.1. On click of Export button, Grid's data source is initialized inside InitializeDataSource with more than 100,000 records fetched from database.

I have got to know that when xml LoadOnDemand is set, each time when I export to excel, I should set

AllowPaging = False  

and

LoadOndemand = LoadOnDemand.NotSet

then bind the grid and Export.

Fetching huge data from database is taking long time and binding it is taking even longer. After binding, while exporting to excel it is throwing 'System Out of Memory' exception.

Issue 3:

I am not sure even after solving the issues above, will I be able to export more than 65535 rows in Excel 97-2003?

How to optimize the performance of all the operations of the grid with the xml LoadOnDemand.

Code:

Protected Sub UWGrid_InitializeDataSource(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.UltraGridEventArgs) Handles UWGrid.InitializeDataSource

UWGrid.DataSource = dsData 'record set with 100000 rows.

End Sub

Protected Sub btnExportToExcel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExportToExcel.Click

UWGrid.DisplayLayout.Pager.AllowPaging = False

UWGrid.DisplayLayout.LoadOnDemand = LoadOnDemand.NotSet

UWGrid.DataBind()

'Dim wBook As New Excel.Workbook(Excel.WorkbookFormat.Excel2007)

UltraWebGridExcelExporter1.DownloadName = "ExportFile.xls"

UltraWebGridExcelExporter1.Export(UWGrid)

End Sub
Was it helpful?

Solution 2

Reply from Infragistics was to split the records across more than one workbooks. Because there is a limitation of not allowing more than 65535 rows.

Though Their new WebGrids resolved that limitation and I resolved mine by exporting to a CSV file.

So no definite answer to the question, only work around :)

OTHER TIPS

To answer your Issue 3 - 65535 rows is not Infragistics limitation, it's a limitation of Excel 97/2003 format. The only way around it is to export in Excel 2007+ format (XLSX)

private void Form1_Shown(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("Serial number");
        dt.Columns.Add("Name");
        dt.Columns.Add("Values");
        for (int i = 0; i < 500; i++)
        {
            dt.Columns.Add("Column" + i.ToString());
        }
        for (int i = 0; i < 100000; i++)
        {
            dt.Rows.Add(i.ToString(), "Jipson PJ", (i + 100).ToString());
        }

        ultraGrid1.DataSource = dt;
    }

    private void button1_Click(object sender, EventArgs e)
    {

        Workbook w = new Infragistics.Excel.Workbook();

        //w.CurrentFormat = WorkbookFormat.Excel2007;
        w.Worksheets.Add(this.Text);
        this.ultraGridExcelExporter1.FileLimitBehaviour = Infragistics.Win.UltraWinGrid.ExcelExport.FileLimitBehaviour.TruncateData;

        this.ultraGridExcelExporter1.Export(this.ultraGrid1, w.Worksheets[this.Text]);

        w.Save("C://Users//jipso//Documents//excel//1.xls"); // Save as .xlsx file name.
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top