Search code examples
c#jqueryasp.net-mvcnew-window

Refreshing a page that opened a new tab/window


I'm currently writing an internal application that handles our company's billing using MVC 3.

One of the requirements that Finance has is that a user can access a particular Client's Properties (A one-to-many relationship) through a tab control on the page. When they want to edit or delete a property, they want the Edit/Delete screen to come up in a new tab or window.

If they decide to delete the property in the new tab/window, how can I refresh the first tab/window so that they can't select the recently deleted property?

EDIT: I forgot to mention that when they are finished editing/deleting the property the tab/window automatically closes.


Solution

  • Time to answer my own question, based on this answer to a different question that discussed the beforeunload event.

    So I hooked up the beforeunload event to do the refresh on the window's opener by doing the following script:

     $(window).bind("beforeunload", function () {
          window.opener.location.reload(true);
     })
    

    Nice, clean, and simple.