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

Home Posts Topics Members FAQ

window.open

hey guys i've got a question as to why something is happening.

basically building a web application, and i want to open up another .aspx form, but not
close the one i have.

so, i assign a button this.

MyButton.Attributes.Add("onclick", "window.open('MyForm.aspx');")

it works great but, it takes two clicks before it responds. i really do like the effect of the other .aspx file opening, leaving the main.aspx intact.
i was just wondering why, it takes "two-clicks".

the other thing i like is, it's minimal code.

does anyone know, why and is there a better solution, than the one i'm using?

thanks again

rik
************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Nov 19 '05 #1
4 2870
rik butcher wrote:
hey guys i've got a question as to why something is happening.

basically building a web application, and i want to open up another
.aspx form, but not
close the one i have.

so, i assign a button this.

MyButton.Attributes.Add("onclick", "window.open('MyForm.aspx');")

it works great but, it takes two clicks before it responds. i really
do like the effect of the other .aspx file opening, leaving the
main.aspx intact. i was just wondering why, it takes "two-clicks".

the other thing i like is, it's minimal code.

does anyone know, why and is there a better solution, than the one
i'm using?


Where did you put this line of code? Was it in Page_Load, or was it in an
event handler?
It should be in Page_Load.

--

Riki
Nov 19 '05 #2
it's basically in a click_event:

Private Sub btnHelp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHelp.Click
btnHelp.Attributes.Add("onclick", "window.open('Help.aspx');")
End Sub

i guess i'm a little confused on why this would be in page load, since it's based on a click event. but, i'm pretty new to web apps.

do you mean build a Load template like this?:

Private Sub btnHelp_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnHelp.Load
btnHelp.Attributes.Add("onclick", "window.open('Help.aspx');")
End Sub
i changed to this and it's a one click now.

thanks
rik

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Nov 19 '05 #3
rik butcher wrote:
i guess i'm a little confused on why this would be in page load,
since it's based on a click event. but, i'm pretty new to web apps.


The reason is that the client script is only added after
the first Click event is handled on the server.

This means:
1) you click
2) server adds client script
3) you have to click again to activate the client script.

Hope this makes it clear for you.

--

Riki
Nov 19 '05 #4
Alternativley you could just put

onclick="window.open('Help.aspx');"

in the button's tag

ie.

<input type="button" value="Click This Button for Help"
onclick="window.open('Help.aspx');" />

--
Martin Eyles
ma**********@NOSPAM.bytronic.com

"Riki" <ri**@nospam.com> wrote in message
news:eg**************@TK2MSFTNGP15.phx.gbl...
rik butcher wrote:
i guess i'm a little confused on why this would be in page load,
since it's based on a click event. but, i'm pretty new to web apps.


The reason is that the client script is only added after
the first Click event is handled on the server.

This means:
1) you click
2) server adds client script
3) you have to click again to activate the client script.

Hope this makes it clear for you.

--

Riki

Nov 19 '05 #5

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

Similar topics

3
by: Michael | last post by:
I am trying to allow a user to view a PDF in a new window. I currently have this working using the following: <a href="./pdf.do?parameter=01121980" target="top"><b>pdf</b></a> The problem...
13
by: Kai Grossjohann | last post by:
It seems that Ctrl-N in Mozilla opens a new empty browser window. That's fine, I don't need to do anything about it. But Ctrl-N in IE appears to clone the current window. Is there a way to...
10
by: Marshall Dudley | last post by:
When I do the following line in Netscape, the popup loads as it should, but the parent window usually, but not always, reloads as well. <a href="#"...
2
by: Samir Pandey | last post by:
Hello, I am using the following javascript code to open a new window. Somehow, IE always opens a new window. It doesn't open target url in the window name given. All i want is, if there is a...
3
by: NeverLift | last post by:
But, if it's not open, I don't want to open it . . . using window.open will open it if it doesn't exist, even if the url in that open is null (the window is then empty -- but it's open). The...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
6
by: G Dean Blake | last post by:
in my aspx app I am writing a stream that works fine but it replaces what is in the client browser window. The code is as follows: .. .. HttpContext.Current.Response.ClearHeaders()...
8
by: johnsonholding | last post by:
Here is the code for a pop-up window that works in Firefox and not in IE - I get a java error or something, Here is the code : </script> <SCRIPT language="JavaScript"...
7
by: anthony.turcotte | last post by:
Hi, I've looked for a solution to this problem on google, read posts in this newsgroup and I still haven't found anything that could help me. Here's the scenario. 1. User accesses...
3
by: Andrew Poulos | last post by:
There's a HTA application that's running on a local computer (not from a URL) and the user can open a new HTML window by clicking a button The first time the user clicks the button the window...
0
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
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
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...
1
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...
1
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...
0
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.