Reputation: 413
I am rendering an rdlc report to the client directly, tried adding the page number using the code below in the footer
=Globals.PageNumber & " of " & Globals.TotalPages
I am getting #Error when the report is rendered as pdf on the client. Need assitance to resolve the error.
Upvotes: 1
Views: 3174
Reputation: 81
Late answer, but for me it was a security issue.
I checked the warnings received from render method.
Warning[] warnings; //<-- Check these errors
var reportData = localReport.Render("PDF", null, out mimeType, out encoding,
out fileNameExtension, out streamIds, out warnings);
Found the following error:
The Value expression for the textrun ‘PageNumber.Paragraphs[0].TextRuns[2]’ contains an error: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Solution was to add the following line before rendering:
localReport.SetBasePermissionsForSandboxAppDomain(AppDomain.CurrentDomain.PermissionSet.Copy());
Upvotes: 2
Reputation: 11
I got it solved. I started to create another page but ended up deleting the reference Microsoft.ReportViewer.WebForms and readded the correct version back I think that solved my problem. Hurray.
Upvotes: 1
Reputation: 2388
I think you want
=Globals!PageNumber & " of " & Globals!TotalPages
Upvotes: 3