SharePoint 2010 introduced the modal popup dialog – many settings & features open a nice-looking dialog window rather than changing your current location or opening a whole new window like they did in previous versions. It’s all smoke and mirrors, of course – in reality you’re still opening a different window, it’s just a nice little formatted one that acts like a dialog box instead of a browser window. SP2010 comes with a packaged function for opening these windows called OpenPopUpPage, and it’s used like the following example:
This example opens an InfoPath list form. The “?IsDlg=1” part tells it not to show the navigation & other site elements. Overall, this is a handy way to deliver forms & settings pages without interrupting the user experience. Sometimes, though, you need to refresh the original page after the user finishes with the modal dialog – when changing content on the page, for example. In my case, I just tacked a window.reload(); onto the end and thought I was done. What I found, though, was that the refresh was occurring in tandem with the popup… which effectively killed the popup.
A quick google session found a few solutions, the first few of which involved writing my own function to replace the OOTB SharePoint one or overly-complicated JQuery. The fifth result I looked at, however, had a very simple solution that does exactly what I want. Turns out that all you have to do is add the RefreshPage attribute to the event like so:
This one little change tells the function to refresh the page after closing the popup. Nice.