Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Crystal reports

Crystal reports

Scheduled Pinned Locked Moved ASP.NET
helpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jmshastri
    wrote on last edited by
    #1

    hello to all. I want to open a crystal report in PDF in new window. but when i click on the button, it opens in the same window. I can't use target=_blank over here, because i am writing code for generating the report in the button's handler, (or can i?) please help me in this matter.

    M 1 Reply Last reply
    0
    • J Jmshastri

      hello to all. I want to open a crystal report in PDF in new window. but when i click on the button, it opens in the same window. I can't use target=_blank over here, because i am writing code for generating the report in the button's handler, (or can i?) please help me in this matter.

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      There two options come to mind: + After you create the pdf report in the button click's handler, you can persist the document on the server side, then open the new page pointing to the pdf document. + Move your code to generate the pdf report to the page opened in the new window.

      J 1 Reply Last reply
      0
      • M minhpc_bk

        There two options come to mind: + After you create the pdf report in the button click's handler, you can persist the document on the server side, then open the new page pointing to the pdf document. + Move your code to generate the pdf report to the page opened in the new window.

        J Offline
        J Offline
        Jmshastri
        wrote on last edited by
        #3

        can you be more specific for first option? the code i am writing is as follows: Dim report As New Doctormaster Dim ms As System.IO.MemoryStream ms = CType(report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat), System.IO.MemoryStream) Response.ClearHeaders() Response.Clear() Response.Buffer = True Response.ContentType = "application/pdf" Try Response.BinaryWrite(ms.ToArray) Response.End() Catch err As Exception Response.Write("< BR >") Response.Write(err.Message.ToString) End Try

        M D 2 Replies Last reply
        0
        • J Jmshastri

          can you be more specific for first option? the code i am writing is as follows: Dim report As New Doctormaster Dim ms As System.IO.MemoryStream ms = CType(report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat), System.IO.MemoryStream) Response.ClearHeaders() Response.Clear() Response.Buffer = True Response.ContentType = "application/pdf" Try Response.BinaryWrite(ms.ToArray) Response.End() Catch err As Exception Response.Write("< BR >") Response.Write(err.Message.ToString) End Try

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          Jmshastri wrote:

          ms = CType(report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat), System.IO.MemoryStream) Response.ClearHeaders() Response.Clear() Response.Buffer = True Response.ContentType = "application/pdf" Try Response.BinaryWrite(ms.ToArray) Response.End()

          I mean once you have the report in the ms object, you can save this stream to file on the server side instead of writing it out to the output stream of the Response object. And what you might need to do next is to emit the client side script to open the new window with a link pointing to the saved file.

          1 Reply Last reply
          0
          • J Jmshastri

            can you be more specific for first option? the code i am writing is as follows: Dim report As New Doctormaster Dim ms As System.IO.MemoryStream ms = CType(report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat), System.IO.MemoryStream) Response.ClearHeaders() Response.Clear() Response.Buffer = True Response.ContentType = "application/pdf" Try Response.BinaryWrite(ms.ToArray) Response.End() Catch err As Exception Response.Write("< BR >") Response.Write(err.Message.ToString) End Try

            D Offline
            D Offline
            Dinuj Nath
            wrote on last edited by
            #5

            The following is code to open a new window from code behind. Put this in the event handler for button click. Dim strPop As String = "" & vbCrLf _ & "window.open('crystalreports.aspx','Report');" & vbCrLf _ & "" & vbCrLf Page.RegisterStartupScript("Pop", strPop) - बुरा जो देखण मै चला, बुरा न िमलया कोय, जो मन खोजा आपणा तो मुझसे बुरा न कोय। Translation

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups