Posts

Showing posts from July, 2016

Close modal dialog when SPLongOperation Complete

protected override void OnClick(EventArgs e) { try{ using (SPLongOperation longOp = new SPLongOperation(this.Page)) { longOp.LeadingHTML = "Long Operation Title"; longOp.TrailingHTML = "This may take few seconds."; longOp.Begin(); //-------------------------- //here code part //--------------------- HttpContext context = HttpContext.Current; if (context.Request.QueryString["IsDlg"] != null) { context.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup();</script>"); context.Response.Flush(); context.Response.End(); } else { string url = SPContext.Current.Web.Url; longOp.End(url, SPRedirectFlags.CheckUrl, context, string.Empty); } } } catch (ThreadAbortException) { /* Thrown when redirected */} catch (Exception ex) { SPUtility.TransferToErrorPage(ex.ToSt