New Browser Window

E

elmo

HI,
This is realy a stupid problem but I cannot find a solution, please help.
I have a asp.net page that displays after a user has logged on to the
system. On this page is a couple of options and depending which option, a
different asp page opens when a BUTTON IS CLICKED. I would like to know how
to progrm the button so that a new browser window opens and not close the
previous one. In the old HTML it was easy, I just used _blank and there you
go. I am using VB on my asp page.

Thanks
Elmo
 
S

Steven Cheng[MSFT]

Hi Elmo,

welcome to ASPNET newsgroup.
As for the question you mentioned, is the button on your ASP.NET page a
normal html button element or an ASP.NET Button Server Control. For open
a new browser window, generally we can use the jscript function
window.open( ) to open a new page and this is often used for a html button
or link's click event. For example:

<input type="button" value="open new window"
onclick="window.open('http://www.asp.net')" />

#be care that such opened window maybe blocked by some popup blockers such
as the one in WIN XP SP2.

If the button is a asp.net button Server control, since the button's click
event is a serverside event, we may need to dynamically inject clientside
jscript code in the Button_click server side event. and the
Page.RegisterStartupScript function may help on this. For example:

private void btnServerOpen_Click(object sender, System.EventArgs e)
{
Page.RegisterStartupScript("open_new","<script
language='jscript'>window.open('http://www.asp.net');</script>");
}

If there're anything unclear or other questions, please feel free to post
here. Hope helps.

Thanks,'

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| NNTP-Posting-Date: Tue, 19 Jul 2005 01:35:44 -0500
| X-Trace-PostClient-IP: 196.14.185.74
| From: "elmo" <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Subject: New Browser Window
| Date: Tue, 19 Jul 2005 08:45:04 +0200
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <[email protected]>
| Lines: 13
| NNTP-Posting-Host: 168.209.98.66
| X-Trace:
sv3-3XskQuB8LEaudaMmnUW8XNsNSISEZI5E6AVLBF0WukGUEC1LnzMm5PlFXRb9EmlBl/bw0WTG
aTpIG+Q!vzNSHT94y+lhwkOFSnHXe0fnecTssGPbEqp6a1FNlTW2WdnROiZqDxiScjxfiyrrutM=
| X-Complaints-To: (e-mail address removed)
| X-DMCA-Complaints-To: (e-mail address removed)
| X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
| X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
complaint properly
| X-Postfilter: 1.3.32
| Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTFEED02.phx.gbl!tornado.fastwebnet.it!tiscali!ne
wsfeed1.ip.tiscali.net!news.maxwell.syr.edu!newscon02.news.prodigy.com!newsc
on06.news.prodigy.com!prodigy.net!border1.nntp.dca.giganews.com!nntp.giganew
s.com!local01.nntp.dca.giganews.com!nntp.is.co.za!news.is.co.za.POSTED!not-f
or-mail
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:113013
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| HI,
| This is realy a stupid problem but I cannot find a solution, please help.
| I have a asp.net page that displays after a user has logged on to the
| system. On this page is a couple of options and depending which option, a
| different asp page opens when a BUTTON IS CLICKED. I would like to know
how
| to progrm the button so that a new browser window opens and not close the
| previous one. In the old HTML it was easy, I just used _blank and there
you
| go. I am using VB on my asp page.
|
| Thanks
| Elmo
|
|
|
 
G

Guest

I just read this message in regards to popup blockers. So are you saying that
possibly, if I'm using WinXP-SP2, and the RegisterStartupScript opens a brand
new ASP.Net page, the popup blocker thats inherent in XP won't allow it?

Whats the alternative? I need some code on my first page to execute, and
then when its done executing, I need to open a new page. I tried adding an
Onclick attribute but that runs first.
 
B

Bruce Barker

there is no alternative. the openwindow must be tied to the onclick event,
foe the popup blocker to allow it. you can move the postback logic to the
popup window. you could change the form target to a new window (must be done
in client code to trick asp.net).


-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top