As this class implements the IDisposable interface, the best is to use a using statement like in the following example:
void buttonProcess_Click(object sender, EventArgs e)
{
using (SPLongOperation operation = new SPLongOperation(this.Page))
{
// Define the url to be redirected after the long operation
string url = "http://myserver/myotherpage.aspx";
operation.LeadingHTML = "Please wait...";
operation.TrailingHTML = "Description...";
operation.Begin();
//Place here the code that takes a long time to be executed
operation.End(url);
}
}
MSDN link: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splongoperation.aspx
No comments:
Post a Comment