Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi every one I have 2 page are page1.aspx and page2.aspx. I create a create a buttion in page1 use Jquery UI to popup page2.aspx
C#
var $advance_add = $('<div></div>').
           html('<iframe id="myFrame" width="100%" height="100%" frameborder="0" src="App_form/Default.aspx" marginwidth="0" marginheight="0"></iframe>')
        .dialog({
            autoOpen: false,
            bgiframe: true,
            width: 650,
            minWidth: 650,
            height: 550,
            closeOnEscape: true,
            modal: true,
            title: 'Theem mowis',
        });


in Page 1 a have a fuction javascript

JavaScript
function abc(val) {
           alert("haha");
       }


i wanna when show popup page2.aspx. a will call functioon abc in page as

JavaScript
function abcd()
        {
           
            abc("akc");
        }


but it not work.

thanks to support
Posted

1 solution

Hi, do you have special need for iframe? Best way is to load a page a display a popup.
Below is the way
Page1.aspx
XML
<input id="Button1" type="button" value="button" />
<div id="popupdiv" style="display:none;" />
<script type="text/javascript" language="javascript">
    $("#Button1").click(function () {
        $.ajax({
            type: 'GET',
            dataType: 'text',
            url: '/HelloWorld/Page2',
            success: function (data) {
                $('#popupdiv').html(data);
                $("#popupdiv").dialog({
                    width: 400,
                    height: 200,
                    modal: true
                });
            }
        });
    });
    function abc() {
        alert("one");
    }
</script>

Page2.aspx
XML
<script type="text/javascript" language="javascript">
    $(function () {
        $('#btnclick').click(function () {
            abcd();
        });

        function abcd() {
            abc();
        }
    })
</script>
<input type="button" id ="btnclick" name="Click"/>


In the calling ajax method just return your aspx page as text
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900