Have a Button call itself?!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
I have to push a button twice to open a new window, only because i have to
set some session variables before opening the window so i can't have the
opennewwindow function called in the page load..
So i'm wondering if there is a way to have the button call itself after it
is pressed, to make it seem like it has been pressed twice.
is that possible???
 
On the first button click when you set the session variables why don't you
write out some script to open the new window? You will save the
information, then call Page.RegisterStartupScript

//this is the first time they are clicking submit.
protected void btnSubmit_Click( ... )
{
//save session variables

//now register the window.open script
Page.RegisterStartupScript( "OpenNewWindow", @"
<script language=""javascript"">
window.open( 'newPage.aspx' );
</script>" );
}

The first page will reload and be sent, and the new window will open. You
won't have to "click" the button again.

HTH,

bill
 

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

Back
Top