By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,202 Members | 1,521 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,202 IT Pros & Developers. It's quick & easy.

How do I launch a new window in ASP.NET

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.