Gary King

Gary King

  • NA
  • 83
  • 209.3k

Problem with window.opener.Reload()

Jun 20 2011 9:34 AM
I have a web app that has a page with a list of items (eg, Red, Green, Blue) and there is a "New" button for creating new items.

When the user clicks "New", a new window opens which the user enters the new item details (eg, Yellow). The user then clicks on the "Add" button which then does the following:

1. Creates the new item record in the database (VB.Net calling a SQL Server Stored Proc)

2. Reloads the window contain the list of items (Javascript: window.opener.reload())

3. Closes the new item window (Javascript: window.close())


Now, back on the list of items screen, the user clicks on a <A HREF> that calls a function that calls a SQL SP that removes the item (it is removed via the code in this page - ie, it does not open a new window). The item is then deleted from the database and disappears from the screen.

If the user then tries to re-add the item as per above, after clicking the "Add" button everything appears to work as per the first time. The problem is that the item is not added to the database and it is not displayed in the list.

We have similar functionality for any page, except this time, it updates a record in the database and sends an email notification of the update. Again, we use window.opener.reload and everything appears to be ok, but the email does not get generated/sent. There are no error messages to suggest a problem.

Anyway, we have manager to resolve the problem by replacing window.opener.reload with window.opener.location = window.opener.location

The frustrating part is that all of the funcationality used to work fine - it is only recently (maybe in the past couple of months) that it has stopped working. Can anyone advise on what has caused this? Have Microsoft changed something in Internet Explorer, IIS, or something else that may cause this?


Many Thanks
Gary


Answers (5)