Check form already open in browser

  • Thread starter Thread starter MikeTI
  • Start date Start date
M

MikeTI

Sep 5, 2009

Hi all

I am new to ASP Net and am using VS2008.

On the click of a button in a form I want to:
1. Check if the second form is already on the browser, to ensure that
another instance of the form does not display.
2. Set focus to the second form without the second form doing any postback.

I have seen some codes in the internet, but the second form does a postback.

function ShowOrderForm()
{
/* If the window doesn't exist or has been closed, open it */
if((typeof newwindow == 'undefined') ||!(newwindow.open) ||
newwindow.closed)
{
newwindow=window.open("Test05.aspx", "my_order");
}

if (window.focus) {newwindow.focus()}
}

Thank you in advance.
MikeTI
 
The second or the first ? For now I would say the button on which you click
is a submit button. The code would run but it would still does a postback.

In the code you shown there is no postback :
- opening a form is not really a post back (this is a GET request but you
have to request the page if you want to display it)
- giving the focus to a window doesn't trigger a postback

You may have something on the second form causing the postback...

So if you just create two empty forms (one wiht a non submit button) and use
this code to switch to the other form you still have the problem ?
 
Back
Top