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 install location>\DeveloperKit10.0\Samples\ServerNET. This folder contains the Common_TaskResults CSharp and VBNet folders.
- Open the folder of the language you're going to use—CSharp or VBNet—and copy the Common_TaskResults_<language> folder to c:\inetpub\wwwroot. The <language> variable can be either 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 opens.
- Click the Directory tab, click the Create button in the Application Settings section, then click OK to close the Properties dialog box.
- Start Microsoft Visual Studio, and open the solution for the version of Visual Studio you're using (2008 or 2010). The Visual Studio version is appended to the solution file name. For example, the Visual Studio 2008 solution file for the Common_TaskResults_CSharp sample is Common_MapTips_CSharp2008.sln and is located in the c:\inetpub\wwwroot\Common_TaskResults_CSharp folder.
- In 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 install location>\DeveloperKit10.0\Samples\data\USA\USA.mxd and <ArcGIS install location>\DeveloperKit10.0\Samples\data\California\California.mxd. For instructions on how to publish a map document to ArcGIS Server, refer to the Publishing a GIS resource to the server topic in the ArcGIS Server Help.
- If these services are not running on the local machine, specify the proper location by following the steps in the Specify host machine section below.
- 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 opens.
- Click the ellipsis next to the Definition property. The Map Resource Definition Editor dialog box opens.
- In the Data Source field, replace localhost with the name of the machine hosting the service.
At run time
- Browse to the application 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're using in the sections below.
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 both 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 is displayed.
- Click the city feature. The MapTip is now shown.
SelectionSet.aspx
- Click the Counties layer on the 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 both 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 are returned, they are automatically zoomed in and displayed in the ZoomToResults control.
ZoomToResultsFilter.aspx
- Click the Find button on the Query Counties task. When the task results are returned, they are automatically zoomed in and displayed 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 simply zooms the map to the results.
TaskResultsPane.aspx
- Click the Find button on the Tabular Results Task. The task results' attributes are displayed tabularly 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 is displayed first, then the feature's attributes are displayed.
- 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 are displayed.
- Expand the MapTips for a different result feature. As with the feature node, an activity indicator is displayed 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 TaskResults control, called OnDemandTaskResults. 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 either 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 in any way 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 both 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 tabularly 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 tabularly. |
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 both 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 tabularly 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 tabularly. |
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