I am trying to export all of the data from an ultra web grid. i see that i need to change the grid to be bound to all of the data. But without completely removing the ability to page, i cannot see how to do this. Any help would be great.
When you call Export() in anything but ExportMode.Custom, it terminates the text/html MIME type response being prepared by the Page and instead begins the binary application/ms-excel MIME type download of .XLS data to the client (in a custom export, you are responsible for doing with the binary stream resulting from an export what you wish, so you could conceivably write it to a file that will be downloaded later and the HTML response can carry-on.) Unless you're doing a custom export or taking unusual steps to persist changes, the viewstate indicating you have turned off paging in the WebGrid isn't ordinarily going to survive, and the HTML of the WebGrid with all data will not be rendered to the client.
Export()
ExportMode.Custom
Hi
I am having similar problems with a grid that was set to use AJAX to improve performance due to large amounts of data being returned.
The grid is Hierarchical, populated with up to three tables. Without AJAX on the grid, it exports to Excel with buttons one the speadsheet to allow drilling into the related data.
However when AJAX is turned on for the grid, two problems are noticed:
1. Only the first page (51 rows) of data is shown in the spreadsheet. With the Document Exporter all the data is exported correctly however when using AJAX.
2. The related data is lost when exporting an AJAX enabled grid with only the top level data being exported.
Ken Paton
Have you tried the suggestion above of using a seperate grid?
If you are just trying to export to excel instead of a pdf or xps then just use the ExcelExporter instead of the DocumentExporter. You should see some code for the ExcelExporter in my first reply on this thread.
This is using the DocumentExporter. I did not see an option to export to excel using this method.
I tried to replicate the behavior using the following code in 2008 Volume 2 but was not able to reproduce:
<body>
<form id="form1" runat="server">
<div>
<igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" Height="200px" Width="325px">
<DisplayLayout ViewType="Hierarchical" AllowSortingDefault="OnClient" HeaderClickActionDefault="SortMulti">
</DisplayLayout>
</igtbl:UltraWebGrid>
<igtbldocexp:UltraWebGridDocumentExporter ID="UltraWebGridDocumentExporter1" runat="server">
</igtbldocexp:UltraWebGridDocumentExporter>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</div>
</body>
{
}
DataSet ds = new DataSet();
DataTable dt2 = new DataTable();
dt.Columns.Add("col1");
dt.Rows.Add(1, "b");
dt2.Columns.Add("col00");
dt2.Rows.Add("a", "abc");
ds.Tables.Add(dt);
ds.Tables.Add(dt2);
this.UltraWebGrid1.DataMember = ds.Tables[0].TableName;
I did try this but for some reason, when using the sepperate grid, it just returned without creating the Excel document, so I have removed AJAX from the grid for now until I have time to investigate further, although this has performance overheads as some of the reports can have a lot of rows.
I did try looking at the export cell event, and can confirm that the temp grid did have the data in it, so the problem seems to be at the final stage when it should be showing the save dialogue.
Anothe issue I am having is that when I export to a PDF File a grid that has data on a lower level that is sorted, the sort is lost and the rows are all in the wrong order, see below:
Customer Name (Top Band)
Help Desk Incident (Middle Band)
Incident Tasks(lower band) - on grid
On the PDF file the lower band is like this: