try{
using (SPLongOperation longOpearation = new SPLongOperation(this.Page))
{
longOpearation.LeadingHTML = "Title of the long operation";//title message
longOpearation.TrailingHTML = "Working on it !”//sub message
longOpearation.Begin();
//Code start
//Write the code that to be processed in long operation
//code ends
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;
longOpearation.End(url, SPRedirectFlags.CheckUrl, context, string.Empty);
}
}
}
catch (Exception ex)
{
SPUtility.TransferToErrorPage(ex.ToString());//transfores us to the error page with error message
}
Comments
Post a Comment