jquery modal pop close button click

jquery modal pop close button click


Dear all,

I am using jquery modal poup to open a page (example from parent page,a.spx, iam opening the child page,b.aspx.)

Following is the code

<script type="text/javascript">
    $(function() {

        $("[id$='lnkbtn']").click(function() {
            var str = $(this).attr("details");
            var page = ('../b.aspx?no=' + str);
            var $dialog = $('<div></div>').html('<iframe style="border: 0px; " src="' + page + '" width="100%" height="100%"></iframe>').dialog({ autoOpen: false, modal: true, height: 500, width: 900});
            $dialog.dialog('open');
        });
    });
</script>

I want to refresh my parent page when the user clicks the clse button(x) on the modal popup (I.E b.aspx).

I went thru the following link but i am not getting the expected op.

http://jsfiddle.net/XM2FH/

Following is the modified code based on my requirment.

<script type="text/javascript">
    $(function() {
        $('#dialog').dialog({
            open: function() //runs every time this dialog is opened
            {
                //var $dialog = $(this);
                var page = ('../../a/bc.aspx');
                var $dialog = $('<div></div>').html('<iframe style="border: 0px; " src="' + page + '" width="100%" height="100%"></iframe>').dialog({ autoOpen: false, modal: true, height: 650, width: 1000 });
                if (!$dialog.data('titleCloseBound')) {
                    $dialog
                    .data('titleCloseBound', true) //flag as already bound
                    .closest('div.ui-dialog') //traverse up to the outer dialog wrapper
                        .find('a.ui-dialog-titlebar-close') //search within it for the X
                            .bind('click', function(e) //bind it
                            {
                                alert('hi');
                                e.preventDefault();
                               __doPostBack('', '');
                            });
                }
            }
        });
    });

Thanks

Nick