Popup an external Page

 

PARENT PAGE…

 

<script type="text/javascript" src="http://www.schimsky.com/jquery/jquery-3.4.1.min.js"></script>

<script type="text/javascript" src="http://www.schimsky.com/jquery/jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>

<link type="text/css" rel="Stylesheet" href="http://www.schimsky.com/jquery/jquery-ui-1.12.1.custom/jquery-ui.min.css">  

 

 

<asp:LinkButton ID="LinkButton1" runat="server"  OnClientClick="OpenPage('Comment', 400, 550, 'Comment.aspx?MyParam=HipHop');return false;" Font-Size="XX-Large">click me</asp:LinkButton>

 

 // ******************************************************************************************************************

 // ******************************************************************************************************************

 // POPUP Info Page Javascript Generic Code.....

 // ******************************************************************************************************************

 // ******************************************************************************************************************

     var MyDialog;

    function OpenPage(sTitle, iHeight, iWidth, PageName) {

        //***************************************************************************************************       

        $('head').append('<style type="text/css">.ui-widget-overlay.ui-front {opacity:.75; }</style>');

        //***************************************************************************************************                 

      

        MyDialog = $("<div></div>").html("<iframe  id='MyIFrame' style='border: 0px; ' src='" + PageName + "' width='100%' height='100%'></iframe>")

            .dialog({

                buttons: [{ text: "Close 1 (no save)", click: function() { $(this).dialog("close"); } }, { text: "Close 2 (no save)", click: function() { $(this).dialog("close"); } }],

                autoOpen: false,

                modal: true,

                height: iHeight,

                show: { effect: 'slide', duration: 1000 },

                hide: { effect: 'slide', duration: 1000 },

                width: iWidth,

                title: sTitle,

                //beforeClose: function(event, ui) { alert('your closing!') }

            })

 

        // Open without the 'x' on the upper right of the window...

        MyDialog.dialog('open').prev().find(".ui-dialog-titlebar-close").hide();;

 

      // This will post back AFTER animation is finished...

        MyDialog.on('dialogclose', function(event) { __doPostBack('cmdHiddenPostBackButton', ''); });

 

 

    } //OpenPage Function

 

 

 

    function closeIframe(SomeParameter) {

        //********************************************************************************************************************************************

        //This function is called from the Child page,(Detail.aspx), like this: Dim sScript As String = “<scrpt>window.parent.closeIframe();</scrpt>”

        //                                                                      ClientScript.RegisterClientScriptBlock(Me.GetType(), "MyKey", sScript, False)

        //**********************************************************************************************************************************************

        MyDialog.dialog('close');

        return false;

    } //CloseIframe 

 

 

    Protected Sub cmdHiddenButton_Click(sender As Object, e As EventArgs) Handles cmdHiddenButton.Click

       'Back from the __DoPostBack...

        Dim parameter As String = Request("__EVENTARGUMENT")

        Response.Write("hi " & parameter)

    End Sub

 

 

CHILD PAGE..

   Protected Sub cmdClose_Click(sender As Object, e As EventArgs) Handles cmdClose.Click

        Dim s As String = "<script>window.parent.closeIframe();</script>"

        ClientScript.RegisterClientScriptBlock(Me.GetType(), "MyKey", s, False)

    End Sub