Bachask8
Bachask8

Reputation: 428

Open aspx page into a modal window and work with it

I would like to open a modal window when i click a button, inside the modal window should load an aspx page with controls and should work (make postbacks, etc).

how can i achive that ?

thanks.

Upvotes: 0

Views: 2001

Answers (2)

Ted
Ted

Reputation: 4067

An easy way of doing this (if you don't need any value exchange between the parent and child window) is to use jquery dialog with an iFrame. Example:

        $("<iframe src='Modal.aspx'></iframe>").dialog({
        open: function () {
            // do something on open
        },
        // add a close listener to prevent adding multiple divs to the document
        close: function (event, ui) {
            // remove div with all data and events
            dialog.remove();
        },
        modal: true,
        resizable: false,
        show: { effect: 'fade', duration: 300 },
        hide: { effect: 'fade', duration: 300 },
        title: "Modal Page Title goes here",
        buttons: //optional
        [
            {
                text: 'Cancel',
                click: function () {
                    dialog.remove();
                }
            },
            {
                text: 'OK',
                click: function () {
                    // do something on OK
                }
            }
        }).appendTo("body");

Upvotes: 2

Milind Anantwar
Milind Anantwar

Reputation: 82231

You need to use iframe inside the modal you are displaying and load you aspx page inside the iframe.

Upvotes: 0

Related Questions