I am using a WebGrid with Paging enabled but the PDF exporter only exports the currently loaded page.
any idea of how to force the exporter to export the entire thing?
Hi Robert
You have to disable paging , and then export the WebGrid, and later you can enable paging again.
UltraWebGrid1.DisplayLayout.Pager.CurrentPageIndex = 1;
UltraWebGrid1.DisplayLayout.Pager.AllowPaging = false;
UltraWebGridDocumentExporter1.Export(UltraWebGrid1);
UltraWebGrid1.DisplayLayout.Pager.PageSize = Convert.ToInt32(PageSizeDDL.SelectedValue);
UltraWebGrid1.DataBind();
Hope this helps
Thanks I will give it a try.
R
Does not seem to work for me. Which event should I be turning paging off in?
In the click event of the button which exports grid to PDF
Still only exporting currently loaded page to PDF.
Here is what I have for the click event:
UltraWebGrid1.DisplayLayout.Pager.CurrentPageIndex = 1
UltraWebGrid1.DisplayLayout.Pager.AllowPaging = False
UltraWebGrid1.DataBind()
UltraWebGridDocumentExporter1.Export(UltraWebGrid1, report)
This sounds like it will take some in-depth research, as I'd previously mentioned. Please submit a support request with a sample project, and a Developer Support Engineer will work with you to figure out what's happening and how to resolve this issue.
I only call export from the click event and I am not even turning paging back on.
Are you possibly calling Export() twice, perhaps once before you set AllowPaging to false and re-bind the grid? I'm not sure which Export() call will take precendence in this situation.
Are you setting AllowPaging back to true in the InitializeLayout event handler?
Other than these thoughts, I don't see anything immediately obvious that would cause only the first page of data to be exported. If the above thoughts don't help, I suggest you submit a support request and attach a sample project that Developer Support can run and debug which reproduces this behavior. It will be easier for Developer Support to identify the cause in this fashion.
Results are no different.
Is there anything else I could be missing?
Try to set the page size to 0 and see if this works.Please see the code below.
UltraWebGrid1.DisplayLayout.Pager.PageSize = 0;
UltraWebGrid1.DisplayLayout.Pager.AllowPaging = False;
UltraWebGridDocumentExporter1.Export(UltraWebGrid1, report);