I was new to the showModalDialog Script on IE. Then I came across a problem with new browser windows being brought up with server content in the dialog This is the solution i came across


I noticed that the following is an issue thru which people often run: when you show an aspx page (or any server content in general) in a dialog by mean of the JavaScript ShowModalDialog method, at the first postback you usually witness the instance of a second window, his time a full blown browser, holding in your output.

There is an easy workaround to the situation, but surprisingly it seems that few people knows it: so I’m posting it.

The trick is showing a static page , a simple .HTML, in the ShowModalDialog call; such page should hold the active content (your .aspx) in an IFRAME. Subsequent posts will be confined inside the iframe, hence restoring the intended user experience.


J proposes a more efficient system: <base target=”_self”>  in the header of the aspx page yields to the same result. Thank you J :-)