Check form already open in browser

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
 
P

Patrice

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 ?
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top