1

Im using webforms reportviewer in my app.

In winforms I have a method that will enable me to print layout mode.

ReportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);

However for WebForms is not done in this way. I searched for some similar method, but not found.

Anyone know somehow using webforms, activate the print layout?

EDIT:

I have this code, if it helps.

        ReportViewer1.ServerReport.ReportServerUrl = new Uri(url);
        ReportViewer1.ServerReport.ReportPath = path;
        ReportViewer1.ShowParameterPrompts = false;
        ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
        ReportParameter parameter1 = new ReportParameter("ID", idSession);
        ReportViewer1.ServerReport.SetParameters(new ReportParameter[] { parameter1 });
        ReportViewer1.ServerReport.Refresh();
PookPook
  • 447
  • 3
  • 11
  • 26
  • what does the .aspx section look like in your code.. for example ` – MethodMan Apr 04 '13 at 15:06
  • @DJKRAZE i edited my question and put code. will that help? – PookPook Apr 04 '13 at 15:18
  • from the looks of it you are missing `ReportViewer1.DataSource` this is what I am not seeing, what browser are you using by the way.. `IE, FireFox, etc...?` – MethodMan Apr 04 '13 at 15:25
  • @DJKRAZE I do not need the datasource. is directly in the report. i only have this code in my app and the report runs. Now I wanted to activate the print layout and I can not. – PookPook Apr 04 '13 at 16:08
  • here is a SO link you can reference someone else asked a similar question http://stackoverflow.com/questions/12985990/set-page-layout-for-report-viewer-in-visual-studio-2010 – MethodMan Apr 04 '13 at 16:13
  • @DJKRAZE did not want to go that way. is that the bar of report viewer control has an option to activate "print layout". in my code, I'm off that bar and by default this option is disabled. The issue is that I wanted to enable this option through the code, because otherwise the report is unformatted. – PookPook Apr 04 '13 at 16:18
  • what version are you using for Crystal Reports – MethodMan Apr 04 '13 at 16:21
  • Im using SQL Server Reporting Services.The link that you sent, speaks in windows forms and I refer to the web forms. Because in Windows Forms by using that method can activate the print layout mode. – PookPook Apr 04 '13 at 16:22
  • can you do something like `ReportViewer.Layout. ...?` I has to be an `Enum` I wish I had it on this laptop, I have done this before in several web projects but it's been over a yr ago so I can't recall off hand.. – MethodMan Apr 04 '13 at 16:25
  • No. Cant do it. Dont have layout option – PookPook Apr 04 '13 at 16:29
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/27571/discussion-between-pookpook-and-dj-kraze) – PookPook Apr 04 '13 at 16:29
  • basically the Layout is nothing but `PageHeight and PageWidth` can you change it that way to test initially to see if it works temporarily ? – MethodMan Apr 04 '13 at 16:29
  • The length and width are adjusted to measure. – PookPook Apr 04 '13 at 16:34
  • here is what I found on MSDN looking at all the Properties of ReportViewer there is something `Called LayoutEngine` and you can drill down to `Layout` here is the link http://msdn.microsoft.com/en-us/library/system.windows.forms.layout.layoutengine.layout(v=vs.80).aspx – MethodMan Apr 04 '13 at 16:38
  • yes, but I'm not noticing. how I put this in asp.net web forms reportviewer control?! The function print layout is in the options bar that controller. There is no property of that control? – PookPook Apr 04 '13 at 16:44
  • Doesn't the WebForms print just utilize the Browser's Print functionality? Therefore the print layout would be defined when you hit print? (Note: The Print Button on the ReportViewer Toolbar only appears in IE) I could be wrong, but I do believe this is how it works. – Shelby115 Apr 22 '13 at 02:26
  • @Shelby115 Regarding the button only appears in IE, didn't know that. – PookPook May 02 '13 at 08:54
  • Can you detail what you want to happen here. Do you want the report to display in the browser window ? If that is the case then the print is taken care of the ReportViewer control. Or do you want it to go directly to PDF and the user can then print from there? In this case you create the ReportViewer totally on the server side and output the PDF back in a stream (like downloading a file). Let us know what you want to do here. – Salik Rafiq Jun 08 '21 at 14:42

0 Answers0