Working with the TaskResults control


In this topic


Creating and modifying contents of a TaskResults control

The TaskResults control works with results from tasks. However, you can explicitly define parent and child node content to take advantage of the context menus and functionality in a TaskResults control without using a task.
Nodes in a TaskResults control are essentially TreeViewPlusNode objects. While a TreeViewPlusNode provides the most fine-grained control over node content, some types are provided to construct content for you. The following are the available and different result object types—SimpleTaskResult, DataSet, and TaskResultNode. These object types can be used with the DisplayResults method on a TaskResults control to add content. 
The following discusses each result object type and includes screen shots of runtime display results with associated code examples.
For information on how to use the TaskResults control, see TaskResults control.

SimpleTaskResult object type

A SimpleTaskResult is a Web Application Developer Framework (ADF) specific object type used to create a node with simple text display in one parent and one child node. The parent node content is the heading and the child node content is the detail. This object type is used for simple message output in a TaskResults control. 
The following code example sample creates a simple parent and child node in a TaskResults control with the string values of "HEADING" and "DETAIL," respectively.
Some parameters in the DisplayResults method are null because the node content is not related to a task. The TaskResults control, TaskResults1, is assumed to be available.
The following screen shot shows the results of the associated code example:

DataSet object type

A DataSet is a .NET Framework object type used for data storage and maintenance. As a versatile type within .NET, a DataSet provides a number of functionality benefits and enhancements to manage data. 
As a standard ADO.NET data type, .NET developers are familiar with and might already be utilizing DataSets and their contents, such as DataTables, DataColumns, and DataRows. DataSets can be used by the TaskResults control directly, without converting between types. As a result, DataSets can be integrated to display with Web ADF applications using the TaskResults control. 
The following code example shows how to create a new DataSet with contents and display it in a TaskResults control. The DataSet instance is included in a call to the DisplayResults method. The TaskResults control, TaskResults1, is assumed to be available.
The following screen shot shows the results of the associated code example:

TaskResultsNode object type

A TaskResultsNode is a Web ADF specific object type used for fine-grained control over node display and actions within a TaskResults control. A TaskResults control generates a collection of TaskResultNodes to display the contents of a DataSet. The TaskResultNodes subclass and TreeViewPlusNode are utilized when explicit control over node properties is required.
The following code example shows how to create two TaskResultNodes, one parent and one child. The style properties of the child node are modified to render the text using the color red. The SetupTaskResultNode method configures the TaskResultNode and child nodes to include a context menu at runtime with the option to remove the node. This is automatically provided with SimpleResultNode and DataSet result types. The TaskResults control, TaskResults1, is assumed to be available.
The following screen shot shows the results of the associated code example:
Working with a TaskResultNode means you want fine-grained control over the organization, style, and actions of nodes in a TaskResult control. 
The following code example shows a TaskResultNode created from the DataSet defined in the DataSet object type section. The first level child nodes text color was changed to "blue." The second level child nodes font style was changed to "italic." 
The TaskResult control maintains a node collection that can be used to insert a TaskResultNode anywhere in the collection. A TaskResults control, TaskResults1, is assumed to be available.
The following screen shot shows the results of the associated code example:


See Also:

TaskResults control