Click here to Skip to main content
13,147,689 members (30,920 online)
Rate this:
Please Sign up or sign in to vote.
Hi everyone

I have a report viewer that programmatically display a rdlc report when user click a button
in button event i do the following:

 System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings();
 pg.Landscape = true;
 pg.Margins.Top = 2;
 pg.Margins.Bottom = 2;
 pg.Margins.Left = 40;
 pg.Margins.Right = 2;
 system.Drawing.Printing.PaperSize size = new PaperSize();
 size.RawKind = (int)PaperKind.A4Extra;
 pg.PaperSize = size;
 DataTable dt = ReceiptsManager.GetAvowelsReportDT(<Parameters>);
 if (dt != null && dt.Rows.Count > 0)
   reportViewer1.LocalReport.ReportPath = <RDLC Report Path>
   ReportDataSource RDS = new ReportDataSource();
   RDS.Name = <RDLC Report Dataset Name>;
   RDS.Value = dt;

the report displayed well but when i click on Printpreview button the viewer displayed a small black box without any contents and when i press right click and choose a pagesetup i see my predefined settings and when i press OK the report displayed

So i want to solve this problem and when user click Printpreview the report displayed with predefined settings

Thanks in advance
Posted 3-Jul-13 5:24am
Updated 3-Jul-13 5:28am
mgoad99 3-Jul-13 13:47pm
I have not had the same exact problem you describe, but i do know that users have to install an active x control to print from the report viewer (same as if running the report directly in the report manager). Typically, the first time a user tries to print they will get a message asking them to install the control. After they install it, they do not get that message anymore. Maybe there is an issue with the control that is giving your users a small black box instead of the message to install?
AhmedYehiaK 3-Jul-13 21:37pm
as i mention before after we see the small black box i press right click and choose PageSetup then i see all the settings which i programmatically set then press OK

then the small black box disappeared and the report displayed well

So i can see and print the report as well but the whole problem in what i mention

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170915.1 | Last Updated 3 Jul 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100