ShowModalDialog postback - SOLUTION

Discussion in 'ASP .Net' started by Jinx, Dec 10, 2003.

  1. Jinx

    Jinx Guest

    Windows IE
    ..NET

    PROBLEM:
    After invoking showModalDialog(), a form comes up, the user clicks
    submit, and a NEW webpage opens.

    SOLUTION
    After reading numerous posts that say, paraphrased, "This can't be
    done, you have to use IFRAMES", I thought I just post a solution.
    Lets be careful with the "cannot be done" posts.

    All you need to do is put this code in the <HEAD> of your modal page:
    <SCRIPT LANGUAGE="JScript">
    window.name="modal";
    </SCRIPT>

    and target="modal" in your modal <FORM> tag. No need for IFRAMES.

    Also, when calling the showModalDialog, pass in a random number as a
    querystring parameter. This will ensure that the modal won't cache
    like they love to do.

    var myRand = rand(50000);
    var modal = window.showModalDialog('mypage.aspx?rand='+myRand, 0,
    windowoptions);

    RANDOM FUNCTIONS
    function rnd() {
    today=new Date();
    jran=today.getTime();

    ia=9301;
    ic=49297;
    im=233280;
    jran = (jran*ia+ic) % im;
    return jran/(im*1.0);
    }

    function rand(number) {
    return Math.ceil(rnd()*number);
    }

    Hope that helps,

    Jinx
    http://www.JinxGear.com
     
    Jinx, Dec 10, 2003
    #1
    1. Advertising

  2. Jinx

    CodeLife

    Joined:
    Jan 21, 2008
    Messages:
    1
    I've always found putting <base target=_self> in the head of the page to work but maybe I'm not understanding the complete problem.
     
    CodeLife, Jan 21, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MikeB
    Replies:
    1
    Views:
    754
    xcasalsv
    Dec 30, 2011
  2. Henry Johnson

    window.showModalDialog and PostBack

    Henry Johnson, Jun 29, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    6,759
    andrei
    Jun 30, 2004
  3. Andrew Francis
    Replies:
    0
    Views:
    426
    Andrew Francis
    Jun 28, 2006
  4. Satya
    Replies:
    1
    Views:
    643
    Bruno Piovan
    Mar 27, 2007
  5. Jonathan
    Replies:
    0
    Views:
    193
    Jonathan
    Jul 19, 2004
Loading...

Share This Page