Check form already open in browser

Discussion in 'ASP .Net' started by MikeTI, Sep 5, 2009.

  1. MikeTI

    MikeTI Guest

    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
    MikeTI, Sep 5, 2009
    #1
    1. Advertising

  2. MikeTI

    Patrice Guest

    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 ?

    --
    Patrice

    "MikeTI" <> a écrit dans le message de
    news:...
    > 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
    >
    Patrice, Sep 5, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TC
    Replies:
    3
    Views:
    3,274
  2. Dino Buljubasic
    Replies:
    4
    Views:
    18,434
    Roedy Green
    Sep 23, 2005
  3. Fabio Pliger

    check instace already running...

    Fabio Pliger, Apr 9, 2005, in forum: Python
    Replies:
    3
    Views:
    429
    Fabio Pliger
    Apr 10, 2005
  4. Nick Sinclair

    How to check for already running program?

    Nick Sinclair, Jul 1, 2005, in forum: C Programming
    Replies:
    4
    Views:
    403
    Nick Sinclair
    Jul 4, 2005
  5. geefypants
    Replies:
    0
    Views:
    142
    geefypants
    Oct 28, 2004
Loading...

Share This Page