Question

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.

Was it helpful?

Solution

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);
    }
}

http://nikpatel.net/2011/04/27/use-splongoperation-to-display-sharepoint-processing-page-for-lengthy-operations/

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top