i am new in sharepoint. I am developing a webpart where user is able to edit multiple records. Here this records get updated in bulk on button click. But there might be situation where user used time more than page timeout which will eventually result in timeout exception or page expired etc. So i do not want to happen this. How can i get timeout in mins or something like that so that i can warn user.
1 Answer
You can enclose the bulk operation code inside SPLongOperation
. This operation has Begin
and End
methods.
protected void btnProvisionSites_Click(object sender, EventArgs e)
{
//Long Operation Code
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
longOperation.Begin();
//Your Long Operation Code Goes Here...
// e.g. Site provisioning code
//End the long operation
string redirectURL = SPContext.Current.Web.Url + "/SitePages/SiteProvisioning.aspx";
longOperation.End(redirectURL);
}
}
-
Thanks @Amal Hashim for your reply. If i use SPLongOperation to perform long tasks, what will be the timeout in minutes?– AshishCommented Dec 8, 2014 at 5:16
-