PageAsyncTask Constructor (BeginEventHandler, EndEventHandler, EndEventHandler, Object, Boolean)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Initializes a new instance of the PageAsyncTask class using the specified value for executing in parallel.

Namespace:   System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public PageAsyncTask(
	BeginEventHandler beginHandler,
	EndEventHandler endHandler,
	EndEventHandler timeoutHandler,
	object state,
	bool executeInParallel
)

Parameters

beginHandler
Type: System.Web.BeginEventHandler

The handler to call when beginning an asynchronous task.

endHandler
Type: System.Web.EndEventHandler

The handler to call when the task is completed successfully within the time-out period.

timeoutHandler
Type: System.Web.EndEventHandler

The handler to call when the task is not completed successfully within the time-out period.

state
Type: System.Object

The object that represents the state of the task.

executeInParallel
Type: System.Boolean

The value that indicates whether the task can be processed in parallel with other tasks.

Exception Condition
ArgumentNullException

The beginHandler parameter or endHandler parameter is not specified.

This implementation of the constructor allows you to set whether the asynchronous task will be processed in parallel with other tasks on the page.

The following code example creates three asynchronous tasks that are processed in parallel to each other. This example is part of a larger example found in the PageAsyncTask class overview.

PageAsyncTask asyncTask1 = new PageAsyncTask(slowTask1.OnBegin, slowTask1.OnEnd, slowTask1.OnTimeout, "Async1", true);
PageAsyncTask asyncTask2 = new PageAsyncTask(slowTask2.OnBegin, slowTask2.OnEnd, slowTask2.OnTimeout, "Async2", true);
PageAsyncTask asyncTask3 = new PageAsyncTask(slowTask3.OnBegin, slowTask3.OnEnd, slowTask3.OnTimeout, "Async3", true);

// Register the asynchronous task.
Page.RegisterAsyncTask(asyncTask1);
Page.RegisterAsyncTask(asyncTask2);
Page.RegisterAsyncTask(asyncTask3);

.NET Framework
Available since 2.0
Return to top
Show: