473,763 Members | 8,423 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I launch a new window in ASP.NET

I have several web apps that I want to redirect to a new page, but have that page open in a new browser window. The basic scenario is that I have a CrystalReport object that gets created and displayed on-screen as a .PDF stream. I need to have this page launch in it's own window leaving the first browser alone

Here's the code I'm using to launch the report

Private Sub btnPrintList_Cl ick(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnPrintList.Cl ic
'Set up and fill the DataSe
Me.DsCalendar1. calMonthlyItems .Clear(
Me.daMonthlyIte ms.SelectComman d.Parameters("@ tStartDate").Va lue = Me.Calendar1.Vi sibleDat
Me.daMonthlyIte ms.SelectComman d.Parameters("@ tEndDate").Valu e = Me.Calendar1.Vi sibleDate.AddMo nths(1).AddDays (-1
Me.daMonthlyIte ms.Fill(Me.DsCa lendar1
'Populate and create the repor
Dim crReport As New EventLis
crReport.SetDat aSource(DsCalen dar1
'Convert the report to a PDF strea
Dim strStream As New System.IO.Binar yReader(crRepor t.ExportToStrea m(CrystalDecisi ons.[Shared].ExportFormatTy pe.PortableDocF ormat)
'Display the PDF content in the browser. Here's where I'd like the system to launch a new browser
Response.ClearC ontent(
Response.ClearH eaders(
Response.Conten tType = "applicatio n/pdf
Response.Binary Write(strStream .ReadBytes(strS tream.BaseStrea m.Length)
Response.Flush(
Response.Close(
End Su

Thanks
Nov 18 '05 #1
1 2195
The only way to launch a new browser window is on the client side, using
JavaScript's window.open() method (well, you can do it with a link and a
target frame, but you have much less control, but in either case you have to
do it on the client, not on the server). What you can do on the server is to
dynamically create the script to open the new window and add it to the Page
using RegisterStartup Script().

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Jacob" <an*******@disc ussions.microso ft.com> wrote in message
news:BD******** *************** ***********@mic rosoft.com...
I have several web apps that I want to redirect to a new page, but have that page open in a new browser window. The basic scenario is that I have a
CrystalReport object that gets created and displayed on-screen as a .PDF
stream. I need to have this page launch in it's own window leaving the
first browser alone.
Here's the code I'm using to launch the report:

Private Sub btnPrintList_Cl ick(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnPrintList.Cl ick 'Set up and fill the DataSet
Me.DsCalendar1. calMonthlyItems .Clear()
Me.daMonthlyIte ms.SelectComman d.Parameters("@ tStartDate").Va lue = Me.Calendar1.Vi sibleDate Me.daMonthlyIte ms.SelectComman d.Parameters("@ tEndDate").Valu e = Me.Calendar1.Vi sibleDate.AddMo nths(1).AddDays (-1) Me.daMonthlyIte ms.Fill(Me.DsCa lendar1)
'Populate and create the report
Dim crReport As New EventList
crReport.SetDat aSource(DsCalen dar1)
'Convert the report to a PDF stream
Dim strStream As New System.IO.Binar yReader(crRepor t.ExportToStrea m(CrystalDecisi ons.[Shared].Exp
ortFormatType.P ortableDocForma t)) 'Display the PDF content in the browser. Here's where I'd like the system to launch a new browser. Response.ClearC ontent()
Response.ClearH eaders()
Response.Conten tType = "applicatio n/pdf"
Response.Binary Write(strStream .ReadBytes(strS tream.BaseStrea m.Length)) Response.Flush( )
Response.Close( )
End Sub

Thanks!

Nov 18 '05 #2

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

Similar topics

4
2401
by: aure_bobo | last post by:
Hi all, I'm currently developping a web app, and this one must be compatible with IE and Mozilla Firefox. In this webapp, I would like to launch automatically a anchor link (href) with a javascript script. My Javascript script works fine with IE but not with Mozilla Firefox. Here is my script : <script language="Javascript">
7
2743
by: Christopher C | last post by:
I am using a C# winform to launch some apps for our students. Basically the user hits a button the form hides and the app is launched. When the app exits, the form is unhidden. I have a question on two things. From what I understand since I am starting the program from the Process.Start it is on a separate thread and this is really not a problem. Secondly what is the best way to work this form. Do I dispose of the form when I start the app...
2
1684
by: Steve Parks | last post by:
Using server-side code, how do I launch a new window? I have an ASP.Net application that uses a frameset, yet I have some (crystal) reports I want to view in a separate window. I can probably launch a window with client-side code, but would prefer to launch it from server-side code. Thank you. Steve
7
2627
by: Paul | last post by:
Hi. I need to launch a windows application and then send keyboard event to this process to run certain commands. I've created a COM+ appplication to spawn and talk to the application which works well however the launched application always shows the UI where-as I need this to be hidden, even calling the windowhidden on the process strart info does not work. Does this somehow need to spawned under a different account process ? ...
4
2065
by: Ernesto | last post by:
I'm trying to launch a seperate telnet window from within my python program. The command I thought I was supposed to use is below: os.system("telnet.exe -f C:\Folder\output.txt localhost 6000") This creates a telnet window inside the current window. This is not desirable. I need it to launch a seperate command window for telnet output. Any ideas ?
3
2028
by: Scott | last post by:
I wish to have a link on a page that launches a new browser before it loads the target link. The standard _new and _blank include the parent browser's cookies. Is there an alternative method that excludes these cookies? Thanks in advance
11
1679
by: David Thielen | last post by:
Hi; In a page, when the user clicks on a button, I want to validate all the controls (in the code behind) and then if they are good, leave that page alone and launch a new window with a new url also. This is what I think is the best approach - please let me know if there is a better one: In my code behind I validate everything.
6
5216
by: Ronald S. Cook | last post by:
How do I launch, say, Microsoft Word from within a C# Win app? Word should launch exterior to my app, of course. Is it easy to set size and position of where Word window will be placed? Thanks, Ron
4
2035
by: =?Utf-8?B?QmVubnk=?= | last post by:
How do I create a new IE window (client script or ASP.NET server code) so that it will create a new ASP session with each new window? Thanks.
0
9564
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
9387
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,...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9823
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...
0
6643
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
5270
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...
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3528
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2794
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.