Posted on 2014-10-07
I have a page with a dropdown, once you choose a value a report runs and comes back in a Gridview. The data takes about 11 or 12 seconds to run and I want to put up some kind of wait, so I found and tried to use SPLongOperation. The code below shoes the wait page, but then returns to the page without the data. I think this is because I do not understand what the last line is doing. Why does the End method of SPLongOperation require a redirect ? I do not want to redirect, I want to stay, after the data is retrieved.
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
using (SPLongOperation longOperation = new SPLongOperation(this.Page))
//Custom Messages on the Spinning Wheel Screen
longOperation.LeadingHTML = "Provisioning Sites";
longOperation.TrailingHTML = "Please wait while the sites are being provisioned.";
//Start the long operation
//Your Long Operation Code Goes Here...
Button1.Visible = true;
//End the long operation
string redirectURL = SPContext.Current.Web.Url + "/SitePages/Report.aspx";
longOperation.End(redirectURL, SPRedirectFlags.Trusted, HttpContext.Current, "");