468,741 Members | 2,038 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,741 developers. It's quick & easy.

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 2006
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by aure_bobo | last post: by
7 posts views Thread by Christopher C | last post: by
2 posts views Thread by Steve Parks | last post: by
7 posts views Thread by Paul | last post: by
4 posts views Thread by Ernesto | last post: by
11 posts views Thread by David Thielen | last post: by
6 posts views Thread by Ronald S. Cook | last post: by
4 posts views Thread by =?Utf-8?B?QmVubnk=?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
xarzu
2 posts views Thread by xarzu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.