Export (0) Print
Expand All

PageAsyncTask.State Property

Gets an object that represents the state of the task.

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

public Object State { get; private set; }

Property Value

Type: System.Object
An Object that represents the state of the task.

The State property is set in the constructor and cannot be modified during execution of the asynchronous task. You can differentiate asynchronous tasks in a page by assigning unique string values to their respective State properties.

The following code example creates three asynchronous tasks and gives them unique values for their State properties. 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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0
Show:
© 2015 Microsoft