Tuesday, 25 May 2010

ASP .Net: Greybox close and refresh parent

There are several steps to this process.

1. Create function in Master page to create new window reload


<script type="text/javascript">

        GB_myShow = function(caption, url, height, width, is_reload_on_close) {

            var options = {

                caption: caption,

                height: height || 500,

                width: width || 500,

                fullscreen: false,

                overlay_click_close: true,

                show_loading: true,

                reload_on_close: is_reload_on_close || false,

                center_win: true

            }

            

        win = new GB_Window(options);

        

            return win.show(url);

        }

    </script>




2. Call class


<a href="Help/PreviousFilter.aspx" onclick="return GB_myShow('Previous Filters', this.href, 330,500, true)" style="color:Blue;"><img src="graphics/Search.png" height="16px" title="Previous Filters" alt="#" /></a>



3. Close parent window
parent.parent.GB_hide();


parent.parent.GB_hide();

<div class="viewcode">

   string test = Session["FilterValue"].ToString();

            string strscrip

Publish Post

t = "<script language=javascript> parent.parent.GB_hide(); </script>";

            //if (window.opener && !window.opener.closed) { window.opener.location.reload(); } </script>";

            //window.top.close();

            if (!ClientScript.IsStartupScriptRegistered("clientScript"))

                ClientScript.RegisterStartupScript(Page.GetType(), "clientScript", strscript);

</div>




No comments:

Post a Comment