Search This Blog

Friday, November 20, 2015

How to close Modal Dialog in sharepoint Programmatically

private void ClosePopUpDialog()
{
  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, 'Close');</script>");
     context.Response.Flush();
     context.Response.End();
     this.Page.Response.End();
    }
    else
    {
      Response.Redirect(SPContext.Current.Web.Url);
    }
  }
  catch(Exception ex)
  {
     throw ex;
    }
}

No comments:

Post a Comment