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

open new window with one click

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


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

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

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