Monday 25 March 2013

Programmatically close dialogue box in share point


private void CloseDlg()
        {
            try
            {
                HttpContext context = HttpContext.Current;
                string strSelUser = string.Empty;
                if (HttpContext.Current.Request.QueryString["IsDlg"] != null)
                {
                    context.Response.Write("<script type=\"text/javascript\">window.frameElement.commonModalDialogClose(0, 'cancelled');</script>");
                    //context.Response.Write("<script type=\"text/javascript\">window.frameElement.commitPopup();</script>");
                    //context.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup()</script>");
                    context.Response.Flush();
                    context.Response.End();
                    this.Page.Response.End();
                }
                else
                {
                    Response.Redirect(SPContext.Current.Web.Url);
                }
            }
            catch { }
        }

No comments:

Post a Comment