JavaScript ShowModalDialog + Aspx page_load event not fires

I was using following code to show  Popup window

//opens a pop up window
function PopupWindow(url) {
mywindow url, “Popupwindow”,
height=600,resizable=1,toolbar=0” )

Above code was showing Popwindow then Requirement changed and we needed a Modal popup Window.  Then I found followin code which provides required functionality.

//opens a pop up window
function PopupWindow(url) {
var ie=document.all;
if (ie)
window.showModalDialog(url,”Window”,”status:no; help:no;
dialogWidth:1200px; dialogHeight:768px”);
var mywindow url, “Popupwindow”,
height=768px,resizable=1,toolbar=0” )

I was using above code to show Audit and History of data for a specified field. This was not working 100% as When we open page in ModalWindow using ShowModalDialog it Caches all data. So the Page_Load Event of my .aspx page was not firing after 1st click for that specific field . As Page_Load event was not firing, I was unable to get the latest changes made by the user.  To See the latest changes made by user we were closing the browser and doing the whole process again i.e. open browser , login , search that record and see the history which was a pain.

To stop the page caching I am now using the page directiv

<%@ OutputCache Location=”None” %>

Above directive is not allowing page to cache anything so my problem is solved.

I can show the latest changes made by the user now. 🙂

Tags: , , , , , , , , ,

5 Responses to “JavaScript ShowModalDialog + Aspx page_load event not fires”

  1. Johann says:

    Did you find a solution for this?

  2. Dhanunjaya Rao says:

    Thanks for the solution. It helped to solve same kind of problem in my application

  3. Kris says:

    It helped me a lot. Thanks!

  4. Brian says:

    Really appreciated!!! It helped me a lot too!!!

  5. Ashraf Safarov says:

    Allah razi olsun…