I have a popup window, which will search for items from a grid. It returns value to the parent page, when a row is selected directly. But if i search the grid by button click and select a row, the parent page receives undefined object, although the correct values are returned from the popup. How can the parent page receive the correct values?
Share
OP did mention this in a comment on the question, but to make it clear: this answer is a copy of this one by user ConnorsFan. If the answer is updated, that’s likely where any updates will appear.
In order to keep using showModalDialog in my page, I had to come up with my own workaround for the bug. So, here it is…
In Google Chrome, after a postback, showModalDialog always returns undefined. However, the window.opener property in the modal dialog points to the caller window, even after postbacks. So, I thought about putting the result of the dialog in the returnValue property of that caller window. And it works.
In the caller window:
At this point, use dlgReturnValue for further processing
In the modal dialog window: