Report Design
 Crystal Reports Forum : Crystal Reports .NET 2003 : Report Design
Message Icon Topic: How to load Reports in a new web Window ? Post Reply Post New Topic
Author Message
louis
Newbie
Newbie


Joined: 22 Jul 2007
Location: United States
Online Status: Offline
Posts: 5
Quote louis Replybullet Topic: How to load Reports in a new web Window ?
    Posted: 27 Jul 2007 at 4:28pm

I need to load every report in a new web window, not in the one where the custom parameters capture is done.


I'm basically having:

- A page .ASPX wich contain an .ASCX wich contain controls to capture the parameters to be passed to the report.
- An aditional page "Reports.ASPX" wich contain the "CrystalReportViewer" and who is in charge of showing every report in my CS web project.

I basically do:

- In the Clic() event of the button which is in charge of launching the report:

// To create a dataset to feed the report according to user request
 dsReport =  GetReportDataSet(GetCurrentUserParams());  
// To create the report object from the report class .rpt
 CurrentReport = new MyReportClass(); 
// To asociate the created DataSet to the report object
 CurrentReport.SetDataSource(dsReport); 
// To pass ussing Session the report to the report form which contain the ReportViewer
 Session.Add("CurrentReport",CurrentReport); 
// To transfer the control to the pages wich is in charge of showing the report
 Server.Transfer("Reports.aspx"); 

- In the Page_Load() event of the page "Reports.aspx"
 ReportClass CurrentReport = (MyReportClass)(Session["CurrentReport"]);
 CrystalReportViewer1.ReportSource = CurrentReport;
 CrystalReportViewer1.Visible = true;


So, everytime, each report is loaded in the same iexplorer window, having to deal with further navigation issues, for instance, loosing navigation history when I send output to PDF instead of previewing it.
Changing targets in the Crystal Report Viewer doesnt work for the first call.


Ok, thanks a lot in advance, I hope it's clear enough my current approach to be improved in such way I mentioned..

L.
 
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 27 Jul 2007 at 4:54pm
This is actually a complicated question and, ironically, it has nothing to do with Crystal Reports. You're basically asking how to use ASP.NET to open a new browser window with code. The fact that it is displaying a report is somewhat irrelevant. The problem comes in that ASP.NET doesn't have a way to open a new browser window via code. The only way to do it is to set the Target property of the button (not what you want), or use javascript to call the window.open() function. The javascript is the best route to take.

Unfortunately, the javascript method doesn't have anyway for you to pass the captured parameters to the new page. So what you need to do then is modify the javascript so that it builds a querystring using the parameter values and passes this to the Reports.aspx page.

Clearly, this is an advanced question and requires extensive knowledge of javascript. Depending upon you level of knowledge with javascript, you may or may not be able to pull this off.

Here is a link to open a new window in javascript, but it doesn't address the hardest part which is building that querystring.

http://aspalliance.com/525
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
louis
Newbie
Newbie


Joined: 22 Jul 2007
Location: United States
Online Status: Offline
Posts: 5
Quote louis Replybullet Posted: 30 Jul 2007 at 5:45am
Yes, Brian thanks a lot.. I did deal with javascript before, I wanted to know whether there was a way to send the report in the server to a new page, using the viewer control probably...
 
Your answer is very clear anyway.
 
Regards and thaks again,
L.
 
 
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.