I have an event receiver triggered on ItemUpdating
that may take some time to run. The code is as follows:
using (SPLongOperation longOperation = new SPLongOperation())
{
//Custom Messages on the Spinning Wheel Screen
longOperation.LeadingHTML = "Enumerating ...";
longOperation.TrailingHTML = "Please wait while the related items are checked.";
//Start the long operation
longOperation.Begin();
foreach (SPListItem someItem in items)
{
strNCStatus = ncItem["Status"].ToString();
if (strStatus != "Closed")
{
properties.ErrorMessage = "The Status Of The Item Cannot Be Changed To Closed Because There Are Open Related Items.";
properties.Status = SPEventReceiverStatus.CancelWithError;
properties.Cancel = true;
}
}
//End the long operation
string redirectURL = SPContext.Current.Web.Url;
longOperation.End(redirectURL);
}
You will notice from the code that SPLongOperation(this.Page)
is not calling the this.Page part.
I want the processing page to display while this operation takes place in the ItemUpdating
.
I don't have a reference to this.Page because my code is running on ItemUpdating
event receiver.
Is it valid to use SPLongOperation
within ItemUpdating
and if so how can I use SPLongOperation
without using this.Page as the parameter?