I have a radgrid with custom pagination enabled, so far all it's working as expected, I mean, each time that OnNeedDataSource event is fired, the grid datasource is updated with the needed data, in my case I have configured a PageSize = 10. So the problems comes when I'm trying to export to PDF, When the RadGrid pagination is in the first page, for example I have 15 items, so the first page is displaying just 10 items, then the export works fine, all items are well exported to pdf file, but if I go to the next page in the grid, in this case are showing the last 5 items in the second page, and I try to export to pdf, I 'm getting a blank pdf. How can I fix this ? some suggestion, please ? Just in case here some fragments of the code :
<
asp:View
ID
=
"ViewFiles"
runat
=
"server"
>
<
telerik:RadAjaxPanel
ID
=
"RadAjaxPanel1"
runat
=
"server"
>
<telerik
:RadGrid
ID
=
"RadGridFiles"
runat
=
"server"
GridLines
=
"None"
TableLayout
=
"Auto"
Skin
=
"Metro"
PageSize
=
"10"
AllowSorting
=
"false"
AllowMultiRowSelection
=
"false"
AllowPaging
=
"true"
AllowCustomPaging
=
"true"
OnNeedDataSource
=
"RadGridFiles_NeedDataSource"
ShowStatusBar
=
"True"
OnBiffExporting
=
"grdSettings_BiffExporting"
OnPdfExporting
=
"grdSettings_PdfExporting"
>
<
ClientSettings
AllowDragToGroup
=
"true"
>
</
ClientSettings
>
<
ExportSettings
ExportOnlyData
=
"true"
IgnorePaging
=
"true"
OpenInNewWindow
=
"true"
> </
ExportSettings
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
AlwaysVisible
=
"True"
/>
<
MasterTableView
TableLayout
=
"Fixed"
>
<
NoRecordsTemplate
>
<
div
>
<asp
:Label
ID
=
"lblNoResultDisplay"
Text
=
"There are no records to display"
runat
=
"server"
CssClass
=
"Label"
meta:resourcekey
=
"lblNoResultDisplayResource"
>
</asp
:Label
>
</
div
>
</
NoRecordsTemplate
>
</
MasterTableView
>
</telerik
:RadGrid>
</telerik:RadAjaxPanel>
</asp:View>
protected
void
btnExport_Click(
object
source, EventArgs e)
{
RadGridFiles.IsExportPDF =
false
;
RadGridFiles.ExportSettings.FileName =
string
.Format(
"SDAR_{0}"
, tabValue);
RadGridFiles.PageSize = RadGridFiles.MasterTableView.VirtualItemCount;
RadGridFiles.ExportHeaderRow =
new
List<
string
>() {
"Document Activity"
};
switch
(fileTypeExport)
{
case
"xml"
:
case
"xls"
:
RadGridFiles.ExportSettings.Excel.FileExtension = fileTypeExport;
RadGridFiles.ExportSettings.Excel.Format = (fileTypeExport ==
"xml"
) ? GridExcelExportFormat.ExcelML : GridExcelExportFormat.Biff;
RadGridFiles.MasterTableView.ExportToExcel();
break
;
case
"pdf"
:
RadGridFiles.IsExportPDF =
true
;
RadGridFiles.ExportSettings.Pdf.PageHeight = Unit.Parse(
"300mm"
);
RadGridFiles.ExportSettings.Pdf.PageWidth = Unit.Parse(
"600mm"
);
RadGridFiles.ExportSettings.Pdf.PageHeader.LeftCell.Text =
"<div style=\"font-size:14px;margin-left:70px;\"> LOGO </div>"
;
RadGridFiles.ExportSettings.Pdf.PageHeader.LeftCell.TextAlign = GridPdfPageHeaderFooterCell.CellTextAlign.Left;
string
dateText =
string
.Format(
"{0} - {1}"
,
this
.StartDate.ToString(
"MMMM dd, yyyy"
),
this
.EndDate.ToString(
"MMMM dd, yyyy"
));
RadGridFiles.ExportSettings.Pdf.PageHeader.RightCell.Text =
"<div style=\"font-size:14px;margin-right:80px;\">"
+ dateText +
"</div>"
;
RadGridFiles.ExportSettings.Pdf.PageHeader.RightCell.TextAlign = GridPdfPageHeaderFooterCell.CellTextAlign.Right;
RadGridFiles.PDFExportColWidths =
new
List<
int
>();
RadGridFiles.MasterTableView.ExportToPdf();
break
;
}
}