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. Advertising

  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. Advertising

  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
    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
    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
    Thanks that worked perfectly !!
     
    pp_, Jul 23, 2012
    #6
    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. Curious Trigger
    Replies:
    1
    Views:
    15,514
    Curious Trigger
    Sep 24, 2006
  2. Stan B
    Replies:
    9
    Views:
    530
    Stan B
    Oct 17, 2006
  3. kurt sune
    Replies:
    2
    Views:
    7,460
    imransyed63
    Aug 19, 2008
  4. J P Singh
    Replies:
    3
    Views:
    308
    Howard Rothenburg
    Feb 11, 2004
  5. Jonathan
    Replies:
    0
    Views:
    193
    Jonathan
    Jul 19, 2004
Loading...

Share This Page