Vittorio Bertocci

Scatter thoughts

ShowModalDialog

ShowModalDialog

  • Comments 29

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 .htm, 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 exprerience.

UPDATE

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

  • <base target="_self">

    Sticking that in the header of the ASPX page you're targetting with .showModalDialog() gets the same results....without resorting to the overhead of IFRAME.

    - J
  • Hasn't the target attribute been deprecated?
  • IIRR turning smartnavigation ON on the aspx that appears in the modal dialog window also gets around this problem. YMMV.
  • HI,

    I've been struggling with this all day. I used the dummy <Iframe> .html, but had a hard time getting the returnvalue.

    I put in the <base....> tag info and that works.

    But I am still having trouble getting the returnvalue.

    In my Parent window I have
    code....
    arrModal = window.showModalDialog
    ("popup.asp",, _
    "dialogHeight:30;
    dialogWidth:33;edge:Raised;center:Yes;help:No;resizable:No;status:No;")

    msgbox arrmodal


    in my popup window I have.

    code.....
    window.returnvalue = "HERE I BE"
    window.close

    The value of arrModal in the parent window when the popup is close is null.


    any ideas? It seems so straight forward.

  • Elisabeth, I've heard of this from others but I never had the time to actually check it out. If you don't have problems of security/confidentiality of data, I know that a lot of people used this workaround: you can put your results on a cookie generated for the purpose (use as ID a GUID supplied from the caller at the dialog opening) and retrieve (and delete) it from the caller page as the dialog closes. Let me know if it worked for you.
  • 11
  • window.returnvalue = "HERE I BE"
    should be

    window.returnValue = "HERE I BE"
  • xxx
  • eth45yh4hy
  • dfg
  • thanks this fix really got me out of a jam ...
  • Hello
    I am also facing the same problem.
    I have added <base target="_self"> tag just below meta tags in <head>
    & also SmartNavigation=true in page directive.
    still after post back the page is opening in new IE instance..
    please help..
  • dfsa
  • ssdfsdf
  • test
Page 1 of 2 (29 items) 12
Leave a Comment
  • Please add 1 and 3 and type the answer here:
  • Post