469,578 Members | 1,742 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

open new window with one click

Hi all,
I need to set a session variable and open a new window with a single click
of an asp.net button. My problem is that it always takes two clicks.. one
sets the session and the other opens the window... if i write the open window
code in the page load, then the window gets open on 1 click and no session
variable was saved...
any ideas how to get around this...

this is my code:

button click code =

Session("test") = Button46.Text
Button46.Attributes.Add("Onclick", "pickschedule()")

javascript function =

function pickschedule()
{
window.open("newWindow.aspx?", "_blank", "height=500, width=575, left=150,
top=150, " +
"location=no, menubar=no, resizable=no, " +
"scrollbars=no, titlebar=no, toolbar=no", true);
}
thanks!
--
Ad****@hotmail.com
Nov 19 '05 #1
3 2214
I don't know what you are trying to set but maybe you can set it on the new
page you are opening.
Nov 19 '05 #2
Session("test") = Button46.Text
Page.RegisterClientScriptBlock("xyz", "<script
language=""javascript"">pickschedule();</script>")

"ACaunter" <Ad****@hotmail.com> wrote in message
news:BC**********************************@microsof t.com...
Hi all,
I need to set a session variable and open a new window with a single click
of an asp.net button. My problem is that it always takes two clicks.. one
sets the session and the other opens the window... if i write the open window code in the page load, then the window gets open on 1 click and no session
variable was saved...
any ideas how to get around this...

this is my code:

button click code =

Session("test") = Button46.Text
Button46.Attributes.Add("Onclick", "pickschedule()")

javascript function =

function pickschedule()
{
window.open("newWindow.aspx?", "_blank", "height=500, width=575, left=150,
top=150, " +
"location=no, menubar=no, resizable=no, " +
"scrollbars=no, titlebar=no, toolbar=no", true);
}
thanks!
--
Ad****@hotmail.com

Nov 19 '05 #3
Thanks for the replies..
I can't seem to get the code to work right.. the page will just flash
(reload) but no new window will open.. if i put it in the page load , then my
code will work but i just can't get the session var. to save...
the session var. is just the name of the button that clicked to open the
page..
there are many buttons and all open the same page, just sets the labels on
the new page to different text..
can i just open the page in the page load, then from the new window find out
which button was clicked to open this page or somethin...
"David Jessee" wrote:
Session("test") = Button46.Text
Page.RegisterClientScriptBlock("xyz", "<script
language=""javascript"">pickschedule();</script>")

"ACaunter" <Ad****@hotmail.com> wrote in message
news:BC**********************************@microsof t.com...
Hi all,
I need to set a session variable and open a new window with a single click
of an asp.net button. My problem is that it always takes two clicks.. one
sets the session and the other opens the window... if i write the open

window
code in the page load, then the window gets open on 1 click and no session
variable was saved...
any ideas how to get around this...

this is my code:

button click code =

Session("test") = Button46.Text
Button46.Attributes.Add("Onclick", "pickschedule()")

javascript function =

function pickschedule()
{
window.open("newWindow.aspx?", "_blank", "height=500, width=575, left=150,
top=150, " +
"location=no, menubar=no, resizable=no, " +
"scrollbars=no, titlebar=no, toolbar=no", true);
}
thanks!
--
Ad****@hotmail.com


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by venkatesh | last post: by
40 posts views Thread by Brian Jorgenson | last post: by
3 posts views Thread by NeverLift | last post: by
6 posts views Thread by Shamin | last post: by
2 posts views Thread by carlor | last post: by
4 posts views Thread by arajunk | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.