Some time when writing a custom solution in SharePoint which takes some time to process, it is nice to show end user some message screen saying something like “Please wait we are dealing with your request”.
In SharePoint 2010 this functionality is available out of the box, we can call SPLongOperation class in code and display the below screen with custom message and also can redirect to a different page after completion.
// Initialise SPLongOperation object and specify message you want end users to see. SPLongOperation lp = new SPLongOperation(this.Page); lp.LeadingHTML = "<div><h2>Processing Request</h2></div>"; lp.TrailingHTML = "<div><h3>Please wait, your request is being processed</h3></div>"; lp.Begin(); // long running code start // long running code end lp.End(Customers.DefaultViewUrl, Microsoft.SharePoint.Utilities.SPRedirectFlags.Default, this.Context, "");
I hope this will help.