NOTE: This API is now obsolete.
Queues a Web Part work item to the thread pool, invokes the specified delegate, and specifies an object to be passed to the delegate when serviced from the thread pool.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
[ObsoleteAttribute("Use Page.RegisterAsyncTask instead.")] protected bool RegisterWorkItemCallback( WaitCallback beginCallBack, Object state )
- Type: System.Threading.WaitCallback
A System.Threading.WaitCallback object representing the delegate to invoke when a thread in the thread pool picks up the work item.
- Type: System.Object
The object that is passed to the delegate when serviced from the thread pool.
Return ValueType: System.Boolean
true if the method succeeds; otherwise, false.
A Web Part should use an asynchronous thread for any operation that could take a significant amount of time. For example, if a database or HTTP request needs to be performed, running this work item on an asynchronous thread will allow other parts to continue processing without being blocked. The WebPart base class provides methods for creating a separate thread for Web Part data fetches and managing these threads to ensure they do not run too long and block the page from rendering. The method can be called anytime before the RenderWebPart method is called. This method operates in a manner similar to System.Threading.ThreadPool.QueueUserWorkItem, but is implemented to work with the event model within a Web Part Page.
If there are unfinished threads when timeout occurs, the RenderWorkItemTimeout method is called instead of the RenderWebPart method. The timeout setting is specified by the value of the Timeout attribute of the <WebPartWorkItem> tag that is contained within the <SharePoint> tag in the web.config file.