473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintList.Clic
'Set up and fill the DataSe
Me.DsCalendar1.calMonthlyItems.Clear(
Me.daMonthlyItems.SelectCommand.Parameters("@tStar tDate").Value = Me.Calendar1.VisibleDat
Me.daMonthlyItems.SelectCommand.Parameters("@tEndD ate").Value = Me.Calendar1.VisibleDate.AddMonths(1).AddDays(-1
Me.daMonthlyItems.Fill(Me.DsCalendar1
'Populate and create the repor
Dim crReport As New EventLis
crReport.SetDataSource(DsCalendar1
'Convert the report to a PDF strea
Dim strStream As New System.IO.BinaryReader(crReport.ExportToStream(Cry stalDecisions.[Shared].ExportFormatType.PortableDocFormat)
'Display the PDF content in the browser. Here's where I'd like the system to launch a new browser
Response.ClearContent(
Response.ClearHeaders(
Response.ContentType = "application/pdf
Response.BinaryWrite(strStream.ReadBytes(strStream .BaseStream.Length)
Response.Flush(
Response.Close(
End Su

Thanks
Nov 18 '05 #1
1 2173
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 RegisterStartupScript().

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

"Jacob" <an*******@discussions.microsoft.com> wrote in message
news:BD**********************************@microsof t.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_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintList.Click 'Set up and fill the DataSet
Me.DsCalendar1.calMonthlyItems.Clear()
Me.daMonthlyItems.SelectCommand.Parameters("@tStar tDate").Value = Me.Calendar1.VisibleDate Me.daMonthlyItems.SelectCommand.Parameters("@tEndD ate").Value = Me.Calendar1.VisibleDate.AddMonths(1).AddDays(-1) Me.daMonthlyItems.Fill(Me.DsCalendar1)
'Populate and create the report
Dim crReport As New EventList
crReport.SetDataSource(DsCalendar1)
'Convert the report to a PDF stream
Dim strStream As New System.IO.BinaryReader(crReport.ExportToStream(Cry stalDecisions.[Shared].Exp
ortFormatType.PortableDocFormat)) 'Display the PDF content in the browser. Here's where I'd like the system to launch a new browser. Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.BinaryWrite(strStream.ReadBytes(strStream .BaseStream.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
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...
7
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...
2
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...
7
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...
4
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")...
3
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...
11
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...
6
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? ...
4
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.