473,831 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET Crystal Report Question

The following code is export the Crystal Report to PDF format on the server
side, then display on the client browser.
Question: How can prompt the PDF's "Print" dialog box, when the PDF was open
completed on the browser.
Thank you for help!

Rdgs,
Hero Ngan

*************** *************** *************** *************** ***********
Imports CrystalDecision s.CrystalReport s.Engine
Imports CrystalDecision s.Shared
Imports CrystalDecision s.Web.Design

Public Class WebForm1
Inherits System.Web.UI.P age

#Region " Web Form"
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
InitializeCompo nent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Dim oRpt As New ReportDocument( )
Dim crLogOnInfo As New TableLogOnInfo( )

Dim ex As New ExportRequestCo ntext()
Dim s As New System.IO.Memor yStream()
Dim exOption As New ExportOptions()

oRpt.Load("C:\I netpub\wwwroot\ homepage\Crysta lReport\Report1 .rpt")

With crLogOnInfo.Con nectionInfo
.ServerName = "xxx.xxx.xxx.xx x"
.DatabaseName = "db"
.UserID = "xxxxx"
.Password = "xxxxxxx"
End With

Dim ReportDatabase As Database
Dim dbTables As Tables
Dim dbTable As Table

' Creates the Database object
ReportDatabase = oRpt.Database

' Set logon information for each table in the report
dbTables = ReportDatabase. Tables
For Each dbTable In dbTables
dbTable.ApplyLo gOnInfo(crLogOn Info)
Next

exOption.Export FormatType = ExportFormatTyp e.PortableDocFo rmat
ex.ExportInfo = exOption

s = oRpt.FormatEngi ne.ExportToStre am(ex)

With HttpContext.Cur rent.Response
.ClearContent()
.ClearHeaders()
.ContentType = "applicatio n/pdf"
.AddHeader("Con tent-Disposition", "inline;
filename=Report 1.pdf")
.BinaryWrite(s. ToArray)
.End()
End With

End Sub

End Class
*************** *************** *************** *************** ***********


Nov 17 '05 #1
0 888

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5996
by: rAGHU | last post by:
Hi, In my ASP.NET web application project we need to design crystal reports with Crystal Reports version 8.5 enterpraise edition(Please Note:It is not the Crystal Reports that comes with VisualStudio.NET). Also the Crsyatl Report software 8.5 version will not be installed in the IIS web server which is hosting my ASP.NET web application. It will be installed in a different server which has .net and IIS 5.0.
1
19191
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal Report at runtime? Example: private void button1_Click(object sender,
1
7882
by: Jason Chan | last post by:
I am beginner on Crystal Report. I want to ask a basic question. How can i display a report in ASP? I search for many web and try the sample from crystal dicussion but no luck, the code does not work at all. I saw many articles mentions RAS (Report Application Server), i want to ask is it necessary to install RAS
4
14306
by: Rick Thiel | last post by:
Hello, I am trying to build a Crystal report VisualStudio.NET for an ASP.NET application. I would like to build a report that doesn't connect to any particular database at design time because I am planning to pass a dataset to the report at runtime. From what I have read, it sounds like unbound fields might be the answer. However, I am having trouble figuring out how to bind these unbound fields to my dataset at runtime.
6
4124
by: Dr. Indera | last post by:
hello, much to my surprise, the version of crystal that comes with visual studio.net 2003 does not have a report preview window. i found out that i have to build a form in visual basic.net and use the crystal view object to be able to view forms. the form works fine for me, so i created a .exe of the form and emailed it to a friend because i thought they would be able to use the form/.exe without having visual studio.net installed. that...
19
3886
by: LP | last post by:
I am using (trying to) CR version XI, cascading parameters feature works it asks user to enter params. But if page is resubmitted. It prompts for params again. I did set ReuseParameterValuesOnRefresh="True" in a viewer, but it still doesn't work. Did anyone run into this problem. What's the solution? Please help. Thank you
2
3075
by: aldous scotch | last post by:
I designed a Crystal Report .rpt from within Microsoft Development Environment 2003 Version 7.1.3088 (VB .NET IDE). I selected database fields from the left side Field Explorer onto the Details (Section3) of the .rpt. Also, I added a new web form myWebform.aspx and a web object CystalReportViewer - CrystalReportViewer1 and had a code behind in ReportSource
0
1686
by: Ray | last post by:
Dear all, I have some questions about the Crystal Report and vb.net 2003. 1. I have installed the crystal report 10 and vs.net 2003. Should I update the crystal report within the vb.net so as to use crystal report 10? Which is better for using the program crystal report 10 or the crystal report within the vb.net to construct the report? 2. Is there any difference for deploying the window application for using crystal report 10 or the...
1
1948
by: Agnes | last post by:
my company got crystal report license to write the report , but my client didn't got it. in my vb.net application, i will call that report. (it runs very well, in my company) Everytime,I modify the report, i will modify in company first, and then copy to my client. Now, as my client run the application and print the report . it sometimes got such errors. "A Crystal Report job failed because a free license could not be obtained in the...
3
3068
by: firozfasilan | last post by:
I am new to visual basic 2008. In the past I have used vb6 to display an existing crystal report. I would like to accomplish the same with vb.net. However I am not clear on the syntax to display a crystal report using the crystal report viewer or crystal report document. Here is my code from vb6 Private Sub Form_Load() CrystalReport1.Connect = "DSN=perfection;UID=crystal;PWD=crystal" CrystalReport1.ReportFileName = "e:\Nittany...
0
9794
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10778
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10210
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7750
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5622
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3077
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.