473,479 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

using window.open javascript in asp.net

I am currently using response.redirect in a aspx to go to a web page.
What I want is to open the page in a new window. My dotnet code is as
follows:

Dim sFileName as string = "/TempReports/tempReport.pdf"
response.redirect(sFileName)

This opens in the same frame and I want to use something like
window.open so I can force a new page and control the size of the
window, etc.... One thing I thought about is calling a javascript
function from within a linkbutton. I don't want to use the
attributes.add because the link button already has code.

I have tried:

Dim scriptString As String = "<script language='javascript'>
{window.open(" & sFileName & ");} </script>"

Response.Write(scriptString)

but the "<script language=javascript></script>" doesn't come across as
a string in my code, it actually comes across as an actual script tag
even though it is in quotes.
I have tried:

Response.Write("<META HTTP-EQUIV=""REFRESH"" Content=""0;URL=" &
sFileName & """ target=""_blank"">")

to at least get it to open in a new window but I can't get it to work.
Even though I have the target=""_blank"" it still opens in the same
frame.

Any suggestions?
Nov 18 '05 #1
3 9748
I think you have to lose the braces { }, and register the script.

Dim scriptString As String = "<script language='JavaScript'>
window.open('/TempReports/tempReport.pdf');</script>"

RegisterStartupScript("whatever", scriptString)

I assume it will work if you drop your sFileName var in there, as well. Worth a try, anyway.

George
"Stephen Witter" <sw*****@enpathmed.com> wrote in message
news:7e**************************@posting.google.c om...
I am currently using response.redirect in a aspx to go to a web page.
What I want is to open the page in a new window. My dotnet code is as
follows:

Dim sFileName as string = "/TempReports/tempReport.pdf"
response.redirect(sFileName)

This opens in the same frame and I want to use something like
window.open so I can force a new page and control the size of the
window, etc.... One thing I thought about is calling a javascript
function from within a linkbutton. I don't want to use the
attributes.add because the link button already has code.

I have tried:

Dim scriptString As String = "<script language='javascript'>
{window.open(" & sFileName & ");} </script>"

Response.Write(scriptString)

but the "<script language=javascript></script>" doesn't come across as
a string in my code, it actually comes across as an actual script tag
even though it is in quotes.
I have tried:

Response.Write("<META HTTP-EQUIV=""REFRESH"" Content=""0;URL=" &
sFileName & """ target=""_blank"">")

to at least get it to open in a new window but I can't get it to work.
Even though I have the target=""_blank"" it still opens in the same
frame.

Any suggestions?


Nov 18 '05 #2
Thanks for your reply. The questions I posted was a process that was
a second choice for me because I couldn't do something I wanted to do
in a web form. As it turns out the reason I couldn't do it the way I
wanted to had to do with misspelling an event name. The event in
dotnet was OnSelectedIndexChanged. I was spelling it
OnSelectedIndexChange.

Funny, it took me almost three weeks to catch that I didn't have a "d"
on the end of my event.

shesh...

"George" <------@----.---> wrote in message news:<fL*********************@bgtnsc04-news.ops.worldnet.att.net>...
I think you have to lose the braces { }, and register the script.

Dim scriptString As String = "<script language='JavaScript'>
window.open('/TempReports/tempReport.pdf');</script>"

RegisterStartupScript("whatever", scriptString)

I assume it will work if you drop your sFileName var in there, as well. Worth a try, anyway.

George
"Stephen Witter" <sw*****@enpathmed.com> wrote in message
news:7e**************************@posting.google.c om...
I am currently using response.redirect in a aspx to go to a web page.
What I want is to open the page in a new window. My dotnet code is as
follows:

Dim sFileName as string = "/TempReports/tempReport.pdf"
response.redirect(sFileName)

This opens in the same frame and I want to use something like
window.open so I can force a new page and control the size of the
window, etc.... One thing I thought about is calling a javascript
function from within a linkbutton. I don't want to use the
attributes.add because the link button already has code.

I have tried:

Dim scriptString As String = "<script language='javascript'>
{window.open(" & sFileName & ");} </script>"

Response.Write(scriptString)

but the "<script language=javascript></script>" doesn't come across as
a string in my code, it actually comes across as an actual script tag
even though it is in quotes.
I have tried:

Response.Write("<META HTTP-EQUIV=""REFRESH"" Content=""0;URL=" &
sFileName & """ target=""_blank"">")

to at least get it to open in a new window but I can't get it to work.
Even though I have the target=""_blank"" it still opens in the same
frame.

Any suggestions?

Nov 18 '05 #3
Been there. Done that. ;-)
"Stephen Witter" <sw*****@enpathmed.com> wrote in message
news:7e**************************@posting.google.c om...
Thanks for your reply. The questions I posted was a process that was
a second choice for me because I couldn't do something I wanted to do
in a web form. As it turns out the reason I couldn't do it the way I
wanted to had to do with misspelling an event name. The event in
dotnet was OnSelectedIndexChanged. I was spelling it
OnSelectedIndexChange.

Funny, it took me almost three weeks to catch that I didn't have a "d"
on the end of my event.

shesh...

"George" <------@----.---> wrote in message

news:<fL*********************@bgtnsc04-news.ops.worldnet.att.net>...
I think you have to lose the braces { }, and register the script.

Dim scriptString As String = "<script language='JavaScript'>
window.open('/TempReports/tempReport.pdf');</script>"

RegisterStartupScript("whatever", scriptString)

I assume it will work if you drop your sFileName var in there, as well. Worth a try, anyway.

George
"Stephen Witter" <sw*****@enpathmed.com> wrote in message
news:7e**************************@posting.google.c om...
I am currently using response.redirect in a aspx to go to a web page.
What I want is to open the page in a new window. My dotnet code is as
follows:

Dim sFileName as string = "/TempReports/tempReport.pdf"
response.redirect(sFileName)

This opens in the same frame and I want to use something like
window.open so I can force a new page and control the size of the
window, etc.... One thing I thought about is calling a javascript
function from within a linkbutton. I don't want to use the
attributes.add because the link button already has code.

I have tried:

Dim scriptString As String = "<script language='javascript'>
{window.open(" & sFileName & ");} </script>"

Response.Write(scriptString)

but the "<script language=javascript></script>" doesn't come across as
a string in my code, it actually comes across as an actual script tag
even though it is in quotes.
I have tried:

Response.Write("<META HTTP-EQUIV=""REFRESH"" Content=""0;URL=" &
sFileName & """ target=""_blank"">")

to at least get it to open in a new window but I can't get it to work.
Even though I have the target=""_blank"" it still opens in the same
frame.

Any suggestions?

Nov 18 '05 #4

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

Similar topics

11
50532
by: Raphael Gluck | last post by:
Hi everyone I am having a little problem with an asp page. I am trying to create a master/detail page, but on this occasion, it's only a small amount of detail, so i want to create a small page,...
9
4493
by: CW | last post by:
I wrote an HTML based chat application. The front end is built entirely on HTML + javascript. Essentially, I have a hidden frame that's refreshed frequently and any new messages are displayed in...
24
3207
by: jonathon | last post by:
Hi all, I have a web app with a popup window for entering data. I don't want to access the web every time this window is opened, as most of the app is AJAX. But I can't figure out how to open...
6
4765
by: Erik Steffl | last post by:
I am trying to create a simple custom web spider using mozilla and javascript, the basic functionality is to open a website and then manipulate it using DOM (possibly opening links etc.). it...
4
34826
by: GrantS | last post by:
I am having a problem closing a popup window opened modally. When I try to close the window (when the user hits save button and the data has been processed), the Popup window opens as a full screen...
0
6410
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to...
6
2384
by: Shashi | last post by:
I have developed ASP.Net application using .Net 1.1 Framework. When the user clicks image file through Java script I am using my search window as below. QueryString =...
6
12057
by: bushi | last post by:
hi everyone! i have diplayed my hyperlinks in a iframe.when i redirect to next page.the next page also open in the same frame,but i want to open a new browser window,when i click on the...
7
5790
by: Bill H | last post by:
When I do website design I have my screen (on a PC) set for 1600 x 1200 or greater resolution so that I can have as many windows open as I need and not have to flip between them. The issue I have...
0
6899
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...
0
7019
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
7067
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
6847
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...
0
4463
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...
0
2980
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...
0
1288
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 ...
1
555
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
166
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...

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.