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

Problem with Exporting a RadGrid to PDF

4 Answers 244 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 04 Jan 2012, 03:05 AM
I have, I believe, followed the examples correctly, but every time I try to Export to PDF  the entire table opens in the current window.

rgUsers.ExportSettings.ExportOnlyData = true;
rgUsers.ExportSettings.IgnorePaging = true;
rgUsers.ExportSettings.OpenInNewWindow = true;
rgUsers.MasterTableView.ExportToPdf();

I expect to get all the data and I do, If I change the "IgnorePaging" to false I just get the first page, as I would expect. But changing the value of OpenInNewWindow has no observable effect.

I am obviously missing something very simple, but I just can 't see it. Any ideas?

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 04 Jan 2012, 05:03 AM
Hello Martin,

When you are setting OpenInNewWindow, the exported pdf will appear in new window. Also check the following demo.
Grid / Export to PDF

-Shinu.
0
Martin
Top achievements
Rank 1
answered on 06 Jan 2012, 03:08 AM
Shinu:

I agree with what you said, but that is why I am asking the question. I have set OpenInNewWindow to true but it doesn't open in a new window. It opens in the same window and what is more it's not a PDF file. It just opens then entire database in the grid.

I have written a simple application and it works perfectly. What could I be doing that would make ExportToPdf fail? I have tried by using a CommandTemplate and by using CommandItemSettings and the result is the same both times.

I have studied the Demo you mentioned and  am following it, but I don't do all the fancy formatting.

The page does have a MasterPage. I will make it a stand alone page and see if that alters the behavior.

Martin

PS> Why didn't I get an email notification when you replied to my post?
0
Shinu
Top achievements
Rank 2
answered on 06 Jan 2012, 05:33 AM
Hello Martin,

If you have ajaxified your RadGrid, then the exporting feature of the control will work with regular postbacks only. Check the following help documentation which explains more about this.
Export from Ajaxified Grid.

-Shinu.
0
Martin
Top achievements
Rank 1
answered on 06 Jan 2012, 05:35 PM
I finally solved the problem. I knew it was incredibly simple. It worked when I didn't use Ajax. so that gave me a clue and then I wondered HOW the JavaScript function onRequestStart was getting called. Then I added ClientEvents-OnRequestStart="onRequestStart" to the RadAjaxManager and everything worked fine. I must have missed that in the Demos.

Thanks for your help!
Tags
Grid
Asked by
Martin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Martin
Top achievements
Rank 1
Share this question
or