open new window with one click

G

Guest

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!
 
G

Guest

I don't know what you are trying to set but maybe you can set it on the new
page you are opening.
 
D

David Jessee

Session("test") = Button46.Text
Page.RegisterClientScriptBlock("xyz", "<script
language=""javascript"">pickschedule();</script>")
 
G

Guest

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...
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,058
Latest member
QQXCharlot

Latest Threads

Top