This is a migrated thread and some comments may be shown as answers.

Export RadGrid to pdf is blank

3 Answers 232 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roukaya
Top achievements
Rank 2
Roukaya asked on 29 Dec 2012, 10:32 AM
hello all ,
i try to export radgrid to pdf but it still blank,

this is my client side code :

         <telerik:RadGrid runat="server" ID="ReservationsGrid" MasterTableView-ShowHeadersWhenNoRecords="true" OnPdfExporting="ReservationsGrid_PdfExporting" OnNeedDataSource="ReservationsGrid_NeedDataSource" OnGridExporting="ReservationsGrid_GridExporting"
                    AutoGenerateColumns="false" AllowPaging="true" OnItemCommand="ReservationsGrid_ItemCommand" >
                    <PagerStyle PageSizes="10" />
                    <ExportSettings ExportOnlyData="true" Excel-Format="Html"></ExportSettings>
                    <MasterTableView CommandItemDisplay="Top" UseAllDataFields="true">
                        <CommandItemSettings ShowExportToPdfButton="true" ShowExportToExcelButton="true" ShowExportToCsvButton="true" ShowExportToWordButton="true" ></CommandItemSettings>
                        <Columns>
.........

and i've a radajaxmanager :

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <ClientEvents OnRequestStart="onRequestStart" />
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="ReservationsGrid">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="ReservationsGrid" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>



with this script  function :
<script type="text/javascript">
    function onRequestStart(sender, args) {
        if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
                args.get_eventTarget().indexOf("ExportToPdfButton") >= 0 ||
            args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
                args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) {
            args.set_enableAjax(false);
            
        }
    }
</script>



my code behind is :
protected void ReservationsGrid_ItemCommand(object sender, GridCommandEventArgs e)
 {
     switch (e.CommandName)
     {
         case RadGrid.ExportToPdfCommandName:
              
             ConfigureExport();
             ReservationsGrid.MasterTableView.ExportToPdf();
             break;
 
         case RadGrid.ExportToExcelCommandName:
             ConfigureExport();
             ReservationsGrid.MasterTableView.ExportToExcel();
             break;
 
         case RadGrid.ExportToCsvCommandName:
             ConfigureExport();
             ReservationsGrid.MasterTableView.ExportToCSV();
             break;
 
         case RadGrid.ExportToWordCommandName:
             ConfigureExport();
             ReservationsGrid.MasterTableView.ExportToCSV();
             break;
 
         default:break;
     }
    
 }
 
 public void ConfigureExport()
 {
     ReservationsGrid.ExportSettings.ExportOnlyData = true;
     ReservationsGrid.ExportSettings.IgnorePaging = true;
     ReservationsGrid.ExportSettings.OpenInNewWindow = true;
 }


thanks in advance .

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Jan 2013, 12:51 PM
Hi,

Please make sure that the clientside event 'onRequestStart' is firing. You could receive a blank PDF file if the StaticHeaders/Scrolling are enabled.

Thanks,
Princy.

0
Kostadin
Telerik team
answered on 02 Jan 2013, 01:43 PM
Hello Roukaya,

I was not able to reproduce the issue. Could you please provide your OnPdfExporting and OnGridExporting event contents? Additionally I prepared a small sample based on your code and attached it to this thread. Give it a try and let me know how it differs from your real setup.

Greetings,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Roukaya
Top achievements
Rank 2
answered on 03 Jan 2013, 01:22 PM
Kostadin and Princy thank you ..

any code hasn't been worked with me , i think the problem was from Windows 8 Adobe reader application , because
even telerik demo (Exporting grid to pdf) get blank file ..
Tags
Grid
Asked by
Roukaya
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Kostadin
Telerik team
Roukaya
Top achievements
Rank 2
Share this question
or