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
'Declaration <ObsoleteAttribute("Use Page.RegisterAsyncTask instead.")> _ Protected Function RegisterWorkItemCallback ( _ beginCallBack As WaitCallback, _ state As Object _ ) As Boolean 'Usage Dim beginCallBack As WaitCallback Dim state As Object Dim returnValue As Boolean returnValue = Me.RegisterWorkItemCallback(beginCallBack, _ state)
[ObsoleteAttribute("Use Page.RegisterAsyncTask instead.")] protected bool RegisterWorkItemCallback( WaitCallback beginCallBack, Object state )
A System.Threading.WaitCallback object representing the delegate to invoke when a thread in the thread pool picks up the work item.
The object that is passed to the delegate when serviced from the thread pool.
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 RegisterWorkItemCallback 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.