The SPLongOperation is undoubtedly a Good Thing® to let users know that something is happening during a long processing operation. I had cause to use one the other day, and thought that it would be great to be able to change the message during the processing to let the user know which part of the Long Operation it was up to.
Using objLongOp As New SPLongOperation(Me.Page)
objLongOp.LeadingHTML = "Leading HTML"
objLongOp.TrailingHTML = "Trailing HTML"
objLongOp.LeadingHTML = "New Leading HTML"
objLongOp.TrailingHTML = "New Trailing HTML"
Would result in this screen, for 6 seconds:
I wrote a wrapper class called SPLongOperationEx to make sure that in our example after the first 3 seconds the LeadingHTML and TrailingHTML text is updated with the new values. This way you can have much longer Long Operations and still keep the user happy J
3 seconds later ...
This is a fairly trivial programming exercise once you understand how the SPLongOperation class is manipulating the browser, but I thought I would package it up into a separate class for easy re-use to save people some time.
Download the SPLongOperationEx Class here. (VB.NET)
Thanks to my good friend Adrian Bear from i-PMO, here is the C# version with support for line breaks in the message:
Download the SPLongOperationEX Class here. (C#)