FindAddressTask control


In this topic


About the FindAddressTask control

The FindAddressTask control utilizes resources in the GeocodeResourceManager to perform geocode operations. Geocoding is the process of converting a description of a location, such as an address to x,y map coordinates. The user input form is created dynamically at runtime based on the inputs required by the geocode resource.
The match or address candidate results are provided as an ADO.NET dataset and usually display in a TaskResults control. If the geocoded locations display in a TaskResults control that is buddied to a Map control, each point shows as a graphic on the map.

Using the control

  1. Open Visual Studio to add supporting controls on the page. Set up a Web application with a MapResourceManager, GeocodeResourceManager, and Map controls.
  2. Point the GeocodeResourceManager to an available geocoding resource. Add a TaskResults control. At runtime, the TaskResults control displays the results of the FindAddressTask. Through the TaskResults control, geocode results display as interactive client-side graphics with MapTips (by default). You can then interact with the results to change map extent, display selected features, or re-execute the task. TaskResults also display a message while the task executes. The GeocodeResourceManager determines the behavior of the geocoding, including minimum score and whether to find all candidates or the best candidate.
  3. To hide the Find Address panel when the Web site opens, set the FindAddressTask.Visible property to false. To access the form from a link on the page, add a Menu control from the standard ASP.NET Navigation tools, then add a TaskManager from the ArcGIS Web Controls toolbox. Set the BuddyControl property of the TaskManager to the added Menu control. To display the address form when the application starts, set the FindAddressTask.Visible property to true. TaskManager and ASP.NET Navigation controls are not required to use the FindAddressTask, but assist when using the task at runtime.
  4. Set the Map property of the TaskResults control to the Map control to view results highlighted on the map when selected.
  5. To add a FindAddressTask control, display the prepared Web form in design mode, select the Toolbox panel, and expand the ArcGIS Web Controls tab. Drag and drop a FindAddressTask control into the TaskManager control (or if you did not add a TaskManager control, drag the FindAddressTask onto the page). See the following screen shot that shows a page arranged in a table:


  6. In design mode, set the properties for the FindAddressTask control by clicking the FindAddressTask. The Properties window appears with properties for the FindAddressTask. See the following screen shot:


    1. Click the first item in the smart tag menu to choose the TaskResults container or click the TaskResultsContainers property button on the Properties window. The BuddyControl Collection Editor dialog box appears. Click Add to add an item to the collection. Select the TaskResults1 item, then on the right side of the dialog box, click the drop-down list and select the TaskResults control previously added (where the FindPlaceTask displays results when a query is executed). See the following screen shot:


    2. Set the task and query results properties. Using the smart tag on the FindAddressTask, select Configure Task. The Find Address Properties dialog box appears with a General tab and Results tab. Use the General tab to set the GeocodeResourceManager and GeocodeResource you want to use with the FindAddressTask. You can set the runtime name of the task (as it appears in the ASP.NET Navigation control), the button text for the button to execute the task, and a Help tip to provide assistance at runtime when the mouse cursor hovers over the FindAddressTask panel (for example, provide address examples to show the input format). See the following screen shot:


    3. Use the Results tab to set the render properties of matched candidates returned from executing the FindAddressTask. Configure the required TaskResults control as a task results container for the FindAddressTask (for additional property settings, see Step 6, d–g). Buddy the TaskResults control with a Map control to view the FindAddressTask results on the map. The Results tab contains two buttons—Draw with and Highlight with—to set the default and highlight renderer of address match results. At runtime, matched candidate locations display on a map as graphic features using these renderers. When hovering over a result in the TaskResults control or a match location graphic feature on the map, the respective highlight renderer appears. Select the Show MapTips check box to enable MapTips on each match location graphic feature and display the match fields returned for each candidate. See the following screen shots:



      The following optional properties can also be set on the Properties dialog box in Visual Studio:
               
    4. Set the GeocodeResourceManager property to the control previously added, using the drop-down list.
    5. Set the GeocodeResource property to one of the available geocode resources in the drop-down list. If none appears in the drop-down list, ensure that the GeocodeResourceManager property is set and the GeocodeResourceManager control on the page has been set up with at least one geocoding resource.
    6. For the TaskResultsContainers (in the Task property group), add the TaskResults control previously added. Click the ellipsis button in the property's value box to open the BuddyControl Collection Editor dialog box. Add an item to the buddy control list, then set its name to the TaskResults control by using the drop-down list. If this is not set, results will not display on the Web page.
    7. If you added a Menu control and buddied it to the TaskManager control, and want to hide the Find Address input form until the link to find addresses is clicked, then set the Visible property to false.
  7. Set the position of the Find Address input form. By default, the FindAddressTask form appears in a floating window that can be dragged to a new position on the Web page. The opening position does not necessarily correspond to its position on the Web page design form. If preferred, the task panel shown at runtime can be fixed to a specific position.
    1. To fix the form's position to a specific location, set the position style of the FindAddressTask, or a containing control or DIV. To set the style, switch the Web page from design view to the Hypertext Markup Language (HTML) view in Visual Studio. Find the FindAddressTask in the page listing. Insert a style attribute in the control tag and set its position properties to specific values.
    2. Use "position:absolute" to set the query form to an exact position on the page. Use "position:relative" to fix the position relative to its placement to other controls.

      The following code example shows relative placement that is used to ensure the query window is placed in a table cell:
[HTML]
<td>
  <esriTasks:FindAddressTask style="position:relative;top:5px;left:0px;" 
    ID="FindAddressTask1" runat="server" ...>
  </esriTasks:FindAddressTask >
<td>
    1. When fixing the position of the query window, set the CloseButton, Draggable, ExpandCollapseButton, HeightResizable, and WidthResizable properties to false to disallow modifying the query form. Setting Draggable to false disallows moving the query window.
    2. Optionally, in design view, right-click the task control and set the position property. The design time location of the task control will not change. At runtime, the task panel used to provide input and execute the task displays in the position defined for the task at design time.
  1. Use the following properties for the FindAddressTask control to modify your application: 
    • Title—Shows at the top of the address input form (change the default, which is the ID of the control). Choose a title that describes what the task does, for example, Find an address.
    • ButtonText—Text that shows on the button, which executes the task when clicked.
    • FeatureSelectionColor—After the query results display, and the check box next to a feature is selected, the feature highlights with the selection color on the map.
    • ShowFieldAttributes—Determines if feature attributes display in the query results for each feature.
  2. Using the FindAddressTask is similar to using other tasks. The number and name of input text boxes are determined dynamically at runtime from the geocode resource. Typically, inputs include street address and other fields. Type values for each item on the form, then click Find. The results display in the TaskResults control output. See the following screen shot that shows an example query form:


Members

The following table shows a list of properties related to the FindAddressTask control. For more reference information, see the FindAddressTask control in the library reference section.
Property name
Type
Description
ButtonText
string
Text that shows on the button to execute the task.
FeatureSelectionColor
color
Color of the selected features.
GeocodeResource
string
Name of the geocode resource used by the task.
GeocodeResourceManager
string
Name of the geocode resource manager from which the geocode resource is retrieved.
GroupResultsByTable
bool
Determines if the task's results are grouped by layers.
NavigationPath
string
Task's path as it appears in a hierarchical data control buddied to the task's TaskManager.
ShowFieldAttributes
bool
Determines if the task's results have field attributes.
ShowLegend
bool
Legend is only available if GroupResultsByTable is set to true.
TaskResultsContainers
BuddyControlCollection
Controls in which results from the task display.


See Also:

Web ADF controls
Customizing the Web Mapping application




To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
  • ESRI.ArcGIS.ADF.Tasks.dll