Quantcast
Channel: SharePoint 2010 - General Discussions and Questions forum
Viewing all articles
Browse latest Browse all 17574

SPLongOperation not showing modal

$
0
0

I have the following code:

protected void Sync_Btn_Click(object sender, EventArgs e)
        {
            try{
                using (SPLongOperation SyncDBLo = new SPLongOperation(this.Page))
                {
                    SyncDBLo.LeadingHTML = "Running DB Sync Now";
                    SyncDBLo.TrailingHTML = "This may take a few minutes";
                    SyncDBLo.Begin();
                    Begin_Sync(); //LONG RUNNING CODE
                    EndLongOp(SyncDBLo);
            }
            catch (System.Threading.ThreadAbortException) { }
            catch (Exception ex) { Microsoft.SharePoint.Utilities.SPUtility.TransferToErrorPage(ex.ToString()); }

        }

        protected void EndLongOp(SPLongOperation operation)
        {
            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;
                operation.End(url, Microsoft.SharePoint.Utilities.SPRedirectFlags.CheckUrl, context, string.Empty);
            }
        }

I got most of this from other sources indicating it would work.  It seems to run as my page doesn't time out, but no modal dialog is ever displayed.  I wanted to get that working as I've found other code that shows how I may be able to update the modal with information as the process runs but I need to get the modal first.

Please let me know if anyone knows why the dialog is not appearing.

Thank you!


Viewing all articles
Browse latest Browse all 17574

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>