refresh parent window on close showModalDialog?

Discussion in 'ASP .Net' started by Simon Storr, Aug 4, 2003.

  1. Simon Storr

    Simon Storr Guest

    Is it possible to make the parent window refresh when a modal dialog is
    closed? I know I can use

    window.opener.location.reload(true);

    for a 'normal' window, but this doesn't work for showModalDialog. It is
    modal as far as the client is concerned but not the server...

    In my app I have a datagrid on the main aspx page, I pop up a modal dialog
    to edit a record. On closing the modal dialog I'd like to refresh the
    datagrid with the new data.

    Simon
     
    Simon Storr, Aug 4, 2003
    #1
    1. Advertisements

  2. Simon Storr

    Simon Storr Guest

    Nice solution - that will do it nicely :eek:)

    Thanks for your help guys!

    Simon

    "Anatoly" <> wrote in message
    news:...
    > We use showModalDialog a lot.
    > As solution we put on parent web form server side button with style =
    > "display:none"
    > inside client-side function which calls to showModalDialog we "press" this
    > button in case showModalDialog returns true:
    >
    > if(showModalDialog(...))
    > {
    > document.all("btnRefresh").click();
    > }
    >
    > in server-side event onclcik of this button(I called it "btnRefresh") you

    do
    > what you want.(rebind etc...)
    > HTH
    >
    > "Simon Storr" <> wrote in message
    > news:...
    > > Is it possible to make the parent window refresh when a modal dialog is
    > > closed? I know I can use
    > >
    > > window.opener.location.reload(true);
    > >
    > > for a 'normal' window, but this doesn't work for showModalDialog. It is
    > > modal as far as the client is concerned but not the server...
    > >
    > > In my app I have a datagrid on the main aspx page, I pop up a modal

    dialog
    > > to edit a record. On closing the modal dialog I'd like to refresh the
    > > datagrid with the new data.
    > >
    > > Simon
    > >
    > >

    >
    >
     
    Simon Storr, Aug 4, 2003
    #2
    1. Advertisements

  3. Simon Storr

    Anatoly Guest

    We use showModalDialog a lot.
    As solution we put on parent web form server side button with style =
    "display:none"
    inside client-side function which calls to showModalDialog we "press" this
    button in case showModalDialog returns true:

    if(showModalDialog(...))
    {
    document.all("btnRefresh").click();
    }

    in server-side event onclcik of this button(I called it "btnRefresh") you do
    what you want.(rebind etc...)
    HTH

    "Simon Storr" <> wrote in message
    news:...
    > Is it possible to make the parent window refresh when a modal dialog is
    > closed? I know I can use
    >
    > window.opener.location.reload(true);
    >
    > for a 'normal' window, but this doesn't work for showModalDialog. It is
    > modal as far as the client is concerned but not the server...
    >
    > In my app I have a datagrid on the main aspx page, I pop up a modal dialog
    > to edit a record. On closing the modal dialog I'd like to refresh the
    > datagrid with the new data.
    >
    > Simon
    >
    >
     
    Anatoly, Aug 4, 2003
    #3
  4. Simon Storr

    faisalazhar

    Joined:
    Jan 6, 2009
    Messages:
    1
    Likes Received:
    0
    Hi
    Could you please tell me what is

    if(showModalDialog(...)) what is this ... in the parenthesis, i tried it without anything in parenthesis but it doesn't work.:-(

    Waiting for your reply
    Thanks
    FA
     
    faisalazhar, Jan 6, 2009
    #4
  5. Simon Storr

    elizas

    Joined:
    Jan 27, 2010
    Messages:
    27
    Likes Received:
    0
    Location:
    India
    Refresh parent page on closing modal child window/popup

    Instead, you can put the code to refresh the page just below the line that actually opens the modal popup in the parent page. Since code exceution on parent stops at the point when the modal pop window is opened, the next line is executed only after the modal popup has been closed. So if you put the reload call just below the call to open modal popup, the parent would refresh immediately the modal popup is closed.

    Example - To refresh parent page on closing Modal child pop-up window.

    ....on Parent page

    function OpenModalPopUP()
    {
    window.showModalDialog('page.aspx');
    window.location.reload();
    }


    In the above example the first statement opens a modal popup and pauses the execution as long as the popup is open, the next statement reload() is executed right after the child modal popup window is closed.
     
    elizas, Mar 23, 2010
    #5
  6. Simon Storr

    pp_

    Joined:
    Jul 23, 2012
    Messages:
    1
    Likes Received:
    0
    Thanks that worked perfectly !!
     
    pp_, Jul 23, 2012
    #6
    1. Advertisements

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. Raj
    Replies:
    3
    Views:
    13,321
    gautamkhosla29
    Jun 11, 2009
  2. Steve Wark
    Replies:
    3
    Views:
    6,832
    bruce barker
    Oct 28, 2004
  3. Curious Trigger
    Replies:
    1
    Views:
    15,840
    Curious Trigger
    Sep 24, 2006
  4. Stan B
    Replies:
    9
    Views:
    742
    Stan B
    Oct 17, 2006
  5. kurt sune
    Replies:
    2
    Views:
    7,820
    imransyed63
    Aug 19, 2008
  6. J P Singh
    Replies:
    3
    Views:
    617
    Howard Rothenburg
    Feb 11, 2004
  7. gopal srinivasan
    Replies:
    0
    Views:
    536
    gopal srinivasan
    Nov 5, 2004
  8. Shang Wenbin

    close current window using window.close()

    Shang Wenbin, Sep 1, 2005, in forum: Javascript
    Replies:
    10
    Views:
    639
    GĂ©rard Talbot
    Sep 2, 2005
Loading...