Programmatically show processing screen in SharePoint 2010

25. May 2012 08:45 by Rashid Aziz in Sharepoint blogs  //  Tags: ,   //   Comments (0)

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.

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading