How to use
If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.
At design time
- Verify that the Web ADF for the .NET Framework is installed and functioning properly. For information on installing and configuring the Web ADF, consult the installation guide.
- In Windows Explorer, navigate to <ArcGIS Developer Kit install location>\Samples\ServerNET. This folder contains the Common_TaskResults CSharp and VBNet folders.
- Open the folder of the language you are going to use (that is, CSharp or VBNet) and copy the Common_TaskResults_<language> folder to c:\inetpub\wwwroot. The <language> variable can be CSharp or VBNet.
- Open the IIS Manager from Control Panel, Administrative Tools, Internet Information Services (IIS) Manager, or Internet Information Services.
- In the console tree view on the left, navigate to Local Computer, Web Sites, Default Web Site. Expand Default Web Site, right-click the Common_TaskResults_<language> folder, and click Properties. The Properties dialog box appears.
- Click the Directory tab, click the Create button in the Application Settings section, then click OK to close the Properties dialog box.
- Start Visual Studio 2010 for the Common_TaskResults_<language> located in the c:\inetpub\wwwroot\Common_TaskResult_<language> folder.
- In the Solution Explorer, in TaskResultsWebSite, right-click the page you want to view, and select Set As Start Page.
- The pages in this sample are configured to use the USA and California map services, and it is assumed that these are running on the local machine (localhost). You can create these services by publishing the map documents located at <ArcGIS Developer Kit install location>\Samples\data\USA\USA.mxd and <ArcGIS Developer Kit install location>\Samples\data\California\California.mxd. For instructions on how to publish a map document to ArcGIS for Server, see the topic, "Publishing a GIS resource to the server" in the ArcGIS for Server Help.
- If these services are not running on the local machine, specify the proper location by following the steps in the following "Specify host machine" section.
- Save the project.
- Click the Debug drop-down menu and click Start Debugging.
Specify host machine
- Open the page you want to view, open the properties window for the MapResourceManager control, and click the ellipsis next to the ResourceItems property. The ResourceItem Collection Editor dialog box appears.
- Click the ellipsis next to the Definition property. The Map Resource Definition Editor dialog box appears.
- In the Data Source field, replace localhost with the name of the machine hosting the service.
At run time
- Browse to the application's uniform resource locator (URL), for example, http://localhost/Common_TaskResults_CSharp), or start the application from Visual Studio.
- Follow the steps for the particular page you are using in the following sections.
SimpleResult.aspx
- Click Create Simple Task Result.
- A simple task result is added to the TaskResults control.
DataTableResult.aspx
- Click Execute Query. A task result is added to the TaskResults control.
- Expand the task result node and its child nodes. The task result contains nodes with attribute data. These correspond to the rows of a table that was created by executing a query.
GraphicsLayerResult.aspx
- Click Select Cities in Current Extent. Task results are added to the TaskResults and Map controls.
- Expand the task result node and its child nodes. The task result contains nodes with attribute data. These correspond to the attributes of the result features shown on the map. The layer definition specified for the Cities layer has been applied to the results.
ContextMenu.aspx
- Click Create Task Result with Custom Context Menu. A task result is added to the TaskResults control.
- Right-click the Detail node. A custom context menu with a programmatically defined Show Alert item displays.
- On the context menu, click Show Alert. The resulting behavior, a JavaScript alert, matches that specified in ContextMenu.aspx.cs.
ShowOnlyOnClick.aspx
- Move the mouse pointer over a city feature. No MapTip displays.
- Click the city feature. The MapTip displays
SelectionSet.aspx
- Click the Counties layer on the table of contents (TOC). The layer is highlighted and, if Internet Explorer is being used, the browser's status bar displays the selection layer.
- Click Select Features and draw a rectangle on the map by clicking and dragging. For counties that intersect the rectangle, task results are created and added to the Map and TaskResults controls.
- Click Select Features again and draw a new rectangle on the map. The previous task results are replaced by the features that intersect the new rectangle.
ZoomToResultsContainer.aspx
- Click the Find button on the Query Counties task.
- When the task results display, they are automatically zoomed in and display in the ZoomToResults control.
ZoomToResultsFilter.aspx
- Click the Find button on the Query Counties task.
- When the task results display, they are automatically zoomed in and display in the TaskResults control. While this behavior appears identical to that in ZoomToResultsContainer, examining the ZoomToResultsFilter.aspx page reveals the use of both a ZoomToResults control and a TaskResults control. TaskResults is used to display the results, while ZoomToResults zooms the map to the results.
TaskResultsPane.aspx
- Click the Find button on the Tabular Results Task.
- The task results' attributes display in a tabular format in a floating panel.
OnDemandResults.aspx
- Click the Find button on the Query Counties task.
- Expand the Query Counties and Counties task results nodes, and expand a feature node. An activity indicator displays first, then the feature's attributes display.
- On the map, hover over the feature corresponding to the node that was expanded. When the feature's MapTip is shown, expand it. The feature's attributes display.
- Expand the MapTips for a different result feature. As with the feature node, an activity indicator displays first, then the MapTip is updated with the feature's attributes.
- Expand the feature node corresponding to the result on which a MapTip was just displayed. The feature node is updated with attribute data along with the MapTip.
- Click the Find button on the Search Counties task. The on-demand attributes functionality is enabled for this task's results.
Additional information
For task results created by running tasks in the sample Web site, attributes for a particular result are retrieved upon the following:
- The result’s MapTip is expanded
- The result’s FeatureNode is expanded
Retrieving attributes via a MapTip also updates the corresponding FeatureNode and vice versa. Once attributes for a result have been retrieved, they remain on the client, so only one attribute retrieval request is made per result.
This functionality is enabled primarily through a custom OnDemandTaskResults TaskResults control. This control initializes on-demand functionality for task results that are added to it via a NodeAdded event handler. When the control's ShowAttributesOnDemand property is true, any spatial results that are added to it have on-demand functionality enabled. This sample only enables on-demand functionality for TaskResultsNodes that contain one or more GraphicsLayerNodes.
The results attribute data is cached in the Web-tier by OnDemandTaskResults or retrieved from the control that created the results. By default, attribute data is extracted from the results at the time they are added to OnDemandTaskResults, then stored in the Web-tier for later retrieval. In this scenario, only geometry, unique ID, and primary display fields are initially sent to the client for each result. While this reduces the amount of data initially transmitted between the Web application and the client, it does not affect data transmission between the geographic information system (GIS) data server and the Web application. The operating assumption is that all result data is sent to OnDemandTaskResults and is available for Web-tier caching in the NodeAdded event handler. An out-of-the-box SearchAttributesTask is included on the sample Web page to demonstrate this scenario.
To achieve on-demand functionality that does not rely on Web-tier data caching, but rather pushes each feature data request all the way to the GIS data server, the control that creates the results must implement IAttributesOnDemandProvider. This is a custom interface included with the sample that includes one method, GetAttributeData. If a set of results is created by a control implementing this interface, OnDemandTaskResults calls the GetAttributeData method when a result's attribute data is needed, passing the method the unique ID of the feature corresponding to the result. The control implementing IAttributesOnDemandProvider is responsible for retrieving the attribute data and returning it to OnDemandTaskResults. In this scenario, OnDemandTaskResults does not manipulate the result data before it is sent to the client. The assumption is that the results are constructed to include minimal data initially and the appropriate data when GetAttributeData is called. AttributesOnDemandTask, a custom task that extends QueryAttributesTask, is included in the sample to demonstrate how IAttributesOnDemandProvider can be implemented.
Common_TaskResults_CSharp\TaskResultsWebSite\SimpleResult.aspx | Illustrates creation of a simple task result. |
Common_TaskResults_CSharp\TaskResultsWebSite\SimpleResult.aspx.cs | Code behind the .aspx page. |
Common_TaskResults_CSharp\TaskResultsWebSite\DataTableResult.aspx | Illustrates creation of a task result from a DataTable. |
Common_TaskResults_CSharp\TaskResultsWebSite\DataTableResult.aspx.cs | Code behind the .aspx page. |
Common_TaskResults_CSharp\TaskResultsWebSite\GraphicsLayerResult.aspx | Illustrates creation of a task result from a GraphicsLayer. |
Common_TaskResults_CSharp\TaskResultsWebSite\GraphicsLayerResult.aspx.cs | Code behind the .aspx page. |
Common_TaskResults_CSharp\TaskResultsWebSite\ContextMenu.aspx | Illustrates the configuration of a custom context menu for task results. |
Common_TaskResults_CSharp\TaskResultsWebSite\ContextMenu.aspx.cs | Code behind the .aspx page. |
Common_TaskResults_CSharp\TaskResultsWebSite\SelectionSet.aspx | Illustrates placing task results in a single selected set that is updated when a new selection is made. |
Common_TaskResults_CSharp\TaskResultsWebSite\SelectionSet.aspx.cs | Code behind the .aspx page. |
Common_TaskResults_CSharp\TaskResultsWebSite\App_Code\SelectTool.cs | Class containing the implementation of the selection tool. |
Common_TaskResults_CSharp\TaskResultsWebSite\ZoomToResultsContainer.aspx | Illustrates using a custom TaskResults control to display and automatically zoom to task results. |
Common_TaskResults_CSharp\TaskResultsWebSite\ZoomToResultsContainer.aspx.cs | Code behind the .aspx page. |
Common_TaskResults_CSharp\ZoomToResults\ZoomToResults.cs | Class containing the implementation of a custom TaskResults control that automatically zooms to results. |
Common_TaskResults_CSharp\TaskResultsWebSite\ZoomToResultsFilter.aspx | Illustrates the use of a custom TaskResults control to automatically zoom to results that are displayed in a separate TaskResults control. |
Common_TaskResults_CSharp\TaskResultsWebSite\ZoomToResultsFilter.aspx.cs | Code behind the .aspx page. |
Common_TaskResults_CSharp\TaskResultsWebSite\TaskResultsPanel.aspx | Illustrates a custom task that displays the attributes of results in a tabular format in a floating panel. |
Common_TaskResults_CSharp\TaskResultsWebSite\TaskResultsPanel.aspx.cs | Code behind the .aspx page. |
Common_TaskResults_CSharp\TaskResultsWebSite\App_Code\TabularResultsTask.cs | Class containing a task implementation that displays results in a TaskResultsPanel. |
Common_TaskResults_CSharp\TaskResultsWebSite\App_Code\TaskResultsPanel.cs | Class containing an extended floating panel implementation for displaying task results in a tabular format. |
Common_TaskResults_CSharp\TaskResultsWebSite\JavaScript\TaskResultsPanel.js | JavaScript file containing the client-side implementation of the TaskResultsPanel control. |
Common_TaskResults_CSharp\TaskResultsWebSite\OnDemandResults.aspx | Illustrates a TaskResults control that has been customized so that attributes for a task result are retrieved only when the result's feature node or MapTip is expanded. |
Common_TaskResults_CSharp\TaskResultsWebSite\OnDemandResults.aspx.cs | Code behind the .aspx page. |
Common_TaskResults_CSharp\OnDemandTaskResults\OnDemandTaskResults.cs | Class containing an extended TaskResults implementation that configures task results attributes to be retrieved on demand. |
Common_TaskResults_CSharp\OnDemandTaskResults\IAttributesOnDemandProvider.cs | Interface specifying the member that must be implemented for an OnDemandTaskResults control to retrieve results from the control that packages the task results. This enables on-demand retrieval of attributes from the GIS data server, rather than from a Web-tier cache. |
Common_TaskResults_CSharp\OnDemandTaskResults\JavaScript\OnDemandTaskResults.js | JavaScript file containing the client-side logic needed for attributes on-demand functionality. Includes extensions to MapTips, GraphicFeature, and TaskResults, as well as implementations of TreeViewPlusNode, TaskResultNode, GraphicFeatureGroupNode, and GraphicFeatureNode. |
Common_TaskResults_VBNet\TaskResultsWebSite\SimpleResult.aspx | Illustrates creation of a simple task result. |
Common_TaskResults_VBNet\TaskResultsWebSite\SimpleResult.aspx.vb | Code behind the .aspx page. |
Common_TaskResults_VBNet\TaskResultsWebSite\DataTableResult.aspx | Illustrates creation of a task result from a DataTable. |
Common_TaskResults_VBNet\TaskResultsWebSite\DataTableResult.aspx.vb | Code behind the .aspx page. |
Common_TaskResults_VBNet\TaskResultsWebSite\GraphicsLayerResult.aspx | Illustrates creation of a task result from a GraphicsLayer. |
Common_TaskResults_VBNet\TaskResultsWebSite\GraphicsLayerResult.aspx.vb | Code behind the .aspx page. |
Common_TaskResults_VBNet\TaskResultsWebSite\ContextMenu.aspx | Illustrates the configuration of a custom context menu for task results. |
Common_TaskResults_VBNet\TaskResultsWebSite\ContextMenu.aspx.vb | Code behind the .aspx page. |
Common_TaskResults_VBNet\TaskResultsWebSite\SelectionSet.aspx | Illustrates placing task results in a single selected set that is updated when a new selection is made. |
Common_TaskResults_VBNet\TaskResultsWebSite\SelectionSet.aspx.vb | Code behind the .aspx page. |
Common_TaskResults_VBNet\TaskResultsWebSite\App_Code\SelectTool.vb | Class containing the implementation of the selection tool. |
Common_TaskResults_VBNet\TaskResultsWebSite\ZoomToResultsContainer.aspx | Illustrates using a custom TaskResults control to display and automatically zoom to task results. |
Common_TaskResults_VBNet\TaskResultsWebSite\ZoomToResultsContainer.aspx.vb | Code behind the .aspx page. |
Common_TaskResults_VBNet\ZoomToResults\ZoomToResults.vb | Class containing the implementation of a custom TaskResults control that automatically zooms to results. |
Common_TaskResults_VBNet\TaskResultsWebSite\ZoomToResultsFilter.aspx | Illustrates the use of a custom TaskResults control to automatically zoom to results that are displayed in a separate TaskResults control. |
Common_TaskResults_VBNet\TaskResultsWebSite\ZoomToResultsFilter.aspx.vb | Code behind the .aspx page. |
Common_TaskResults_VBNet\TaskResultsWebSite\TaskResultsPanel.aspx | Illustrates a custom task that displays the attributes of results in a tabular format in a floating panel. |
Common_TaskResults_VBNet\TaskResultsWebSite\TaskResultsPanel.aspx.vb | Code behind the .aspx page. |
Common_TaskResults_VBNet\TaskResultsWebSite\App_Code\TabularResultsTask.vb | Class containing a task implementation that displays results in a TaskResultsPanel. |
Common_TaskResults_VBNet\TaskResultsWebSite\App_Code\TaskResultsPanel.vb | Class containing an extended floating panel implementation for displaying task results in a tabular format. |
Common_TaskResults_VBNet\TaskResultsWebSite\JavaScript\TaskResultsPanel.js | JavaScript file containing the client-side implementation of the TaskResultsPanel control. |
Common_TaskResults_VBNet\TaskResultsWebSite\OnDemandResults.aspx | Illustrates a TaskResults control that has been customized so that attributes for a task result are retrieved only when the result's feature node or MapTip is expanded. |
Common_TaskResults_VBNet\TaskResultsWebSite\OnDemandResults.aspx.vb | Code behind the .aspx page. |
Common_TaskResults_VBNet\OnDemandTaskResults\OnDemandTaskResults.vb | Class containing an extended TaskResults implementation that configures task results attributes to be retrieved on demand. |
Common_TaskResults_VBNet\OnDemandTaskResults\IAttributesOnDemandProvider.vb | Interface specifying the member that must be implemented for an OnDemandTaskResults control to retrieve results from the control that packages the task results. This enables on-demand retrieval of attributes from the GIS data server, rather than from a Web-tier cache. |
Common_TaskResults_VBNet\OnDemandTaskResults\JavaScript\OnDemandTaskResults.js | JavaScript file containing the client-side logic needed for attributes on-demand functionality. Includes extensions to MapTips, GraphicFeature, and TaskResults, as well as implementations of TreeViewPlusNode, TaskResultNode, GraphicFeatureGroupNode, and GraphicFeatureNode. |
Download the files for all languages