Open report in second window

I am using VB in VS 2003.
After choosing data in a web form the user clicks a button. A CR report is
produced and saved in a temporay file. CrystalReportViewer is used to present
the report. My problem is that I want to present the report in a separate
window. Note that the report must first be produced based on actual data. Is there a solution for this problem?
Eje2Asked:
Who is Participating?
 
frodomanCommented:
I believe my last comment ( 19550239 ) answered the question.

frodoman
0
 
frodomanCommented:
You can obviously put the viewer on a different form but do you mean a window separate from the one the viewer is on?  If so, you can always export to pdf format and save the pdf document and then open a new window that points to that document.
0
 
Eje2Author Commented:
If I understand you right this means the user must click buttons twice. Once to produce the report and once to display it. I think it looks more proffessional to have only one button "Show report"
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
frodomanCommented:
No, you don't need to click twice.  For example, you can have a button on one form that will instantiate a reportdocument object and export it to pdf, then do a server.redirect to the pdf file.  There are lots of ways to handle the display of reports - perhaps if you can explain exactly what you'd like to do then I can tell you how?
0
 
Eje2Author Commented:
Today the user can view the document in a separate window with Acrobat reader. But the user must use the Back-button on Internet Explorer to come back to the application. If the user instead uses the exitbutton (X) he also looses the connection with the application. That's why I want a separate window to display the report. The user doesn't loose connection with the application independant of how he handles the window where the report is displayed
0
 
Eje2Author Commented:
Sorry. I was writing my comment before I saw yours. This is the code I use today.

    Try
      Response.ClearContent()
      Response.ClearHeaders()
      If FName.Trim.Length = 0 Then
        Response.Write("Ingen utskrift skapad")
      Else
        Response.ContentType = "application/pdf"
        Response.WriteFile(FName)
      End If
      Response.Flush()
      Response.Close()
0
 
frodomanCommented:
What you want to do is from your primary application open a new window.  For example to do this based on a button click apply code like this to your page_load:

   Dim newurl As String = Request.ApplicationPath + "new_window.aspx"
   LinkButton1.Attributes.Add("onclick", "window.open('url', '" + newurl + "', 'menu=no, status=no');return false;");

Replace "newurl" with the url of a new page.  On this new page you can generate the report, save it to a pdf file, then redirect to the pdf document (or you can simply display in a CRViewer, or you can stream it to the browser, etc.).  The key is that the report is executed and viewed in the new window that opens so when they close this window your primary application window is still open and they don't lose the connection.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.