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

Export to PDf in Rad Grid Asking for Password

8 Answers 198 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vishnu
Top achievements
Rank 1
Vishnu asked on 22 Oct 2012, 11:49 AM
Hi ,
I have a telerik rad grid  binded on client side using ajax call.In order to Export the Excel and Pdf ,I have a two button for Excel and PDf  out side the grid and on button click the data will be exported from excel  from  a data table which is binded the radgrid  data source . Export to Excel was working as the expected ,but when i click for export to pdf....the  message says " xxxxxxxxx.pdf is Protected.Please Enter a document Open password".I have tried with different passwords and by enabling and disabling the User password in pdf setting .But of no use.Can any one help me out in this please.Below is the code i had used for exporting to pdf.
 In Button Click event
{
             datatable dt;
             RadGrid.DataSource = dt;
            RadGrid.ExportSettings.IgnorePaging = true;
            RadGrid.DataBind();
            RadGrid.MasterTableView.AllowPaging = true;
            RadGrid.MasterTableView.IsItemInserted = true;
            RadGrid.ExportSettings.OpenInNewWindow = true;
            RadGrid.AllowFilteringByColumn = false;
            RadGrid.ExportSettings.ExportOnlyData = true;
            RadGrid.MasterTableView.HierarchyDefaultExpanded = false;
            RadGrid.MasterTableView.ClearChildEditItems();
            RadGrid.ExportSettings.FileName = filename;
 //RadGrid.ExportSettings.Pdf.UserPassword = "XXXX";
             RadGrid.ExportSettings.Excel.Format = GridExcelExportFormat.Html;
            RadGrid.MasterTableView.ExportToPdf();
            RadGrid.Rebind();
}

8 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 22 Oct 2012, 01:10 PM
Hi Vishnu,

With reference to this forum thread I suppose you are using older version of RadControls. I tried to replicate your issue in the 2012, 1, 215, 35 version but no avail. Please try updating to latest version and let me know the problem exists.

Regards,
Princy.
0
Vishnu
Top achievements
Rank 1
answered on 22 Oct 2012, 01:20 PM
Hi Princy,

I am using the latest version of the Rad Controls version 2012.1.411.35......But the problem  Continues...


Regards,
Vishnu
0
Accepted
Kostadin
Telerik team
answered on 25 Oct 2012, 10:32 AM
Hi Vishnu,

If you are using Simple DataBinding you should not call Rebind() method. Also it is not necessary to call DataBind() if you are using Advance DataBind. I also noticed that your grid should be empty as you use a data table as a datasource which you created at the begging of the OnClick event. Try modify your code and check whether the issue remains.

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
Vishnu
Top achievements
Rank 1
answered on 29 Oct 2012, 09:41 AM
Hi Kostadin,

I tried With the solution you have provide..but the issues continues.....Can u provide me with different solution please.

Regards,
Vishnu
0
Accepted
Kostadin
Telerik team
answered on 31 Oct 2012, 01:01 PM
Hi Vishnu,

Could you tell me what kind of binding you are using? If you are using simple databind you will need to assign data-source and rebind the grid after each operation (for example button click). If you are using Advance DataBind you can call ExportToExcel() method without rebinding the grid.
If this not prove helpful could you share your RadGrid declaration and the related code behind so we can observe the issue locally.

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
Vishnu
Top achievements
Rank 1
answered on 31 Oct 2012, 02:38 PM
Hi Kostadin,

We are binding the grid with simple binding.Actually we are binding  grid to client side ,so we are forced to use simple data binding on server side as there is no solution  for client side to export to excel and pdf.We have created the button on the top of the grid and in button click we are binding the grid data source from data table.
Note: the same functionality for export to excel is working as expected,but Export to Pdf is asking for password.


Regards,
Vishnu
0
Accepted
Kostadin
Telerik team
answered on 05 Nov 2012, 02:42 PM
Hello Vishnu,

I tried to replicate the described problem in our online example, but to no avail. This error is shown because somehow the header of the pdf file is not created properly.  As you already noticed this error was fixed in one of our previous release. Could you please try to reproduce the issue in a small sample and send it to us, so we can test it locally and advice you further? Otherwise it would be hard to determine the source of the problem based on the provided information.

All the best,
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
Vishnu
Top achievements
Rank 1
answered on 05 Nov 2012, 04:47 PM
Hi Kostadin,

I have seen the below example you have provided.But i am binding the grid with header columns included in data table.There was no separate specific header name included in the code.My question is ?how the same code worked as expected for excel but not for pdf.For convenience ,I am including the resultant pdf file whch was obtained for me.


Regards,
Vishnu
Tags
Grid
Asked by
Vishnu
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Vishnu
Top achievements
Rank 1
Kostadin
Telerik team
Share this question
or