Report Generating and long Operation Module Dailog
///
/// Start Long Operation
///
protected void OperationStart()
{
try
{
using (SPLongOperation longOp = new SPLongOperation(this.Page))
{
///title for loading Window
longOp.LeadingHTML = "Long Operation Title";
//Decp or Message for wait
longOp.TrailingHTML = "This may take few seconds.";
//Window Start
longOp.Begin();
//--------------------------
//code for long running operation is here
//---------------------
System.Threading.Thread.Sleep(99999);
EndOperation(longOp);
}
}
catch (ThreadAbortException) { /* Thrown when redirected */}
catch (Exception ex)
{
SPUtility.TransferToErrorPage(ex.ToString());
}
}
///
/// On Operation End Hendler Perfrom action on Operation completed
///
///
protected void EndOperation(SPLongOperation operation)
{
HttpContext Currentcontext = HttpContext.Current;
if (Currentcontext.Request.QueryString["IsDlg"] != null)
{
//do you work here
Currentcontext.Response.Write("");
Currentcontext.Response.Flush();
Currentcontext.Response.End();
}
else
{
//
string SiteURL = SPContext.Current.Web.Url;
operation.End(SiteURL, SPRedirectFlags.CheckUrl, context, string.Empty);
}
}
Sunday, June 2, 2013
Posted by Usama Wahab Khan at 6:33 AM
Labels: SharePoint 2010
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment