The FindPlaceTask control is designed to use ArcWeb Services that provide
place-name searchable layers. The control interface includes a
simple textbox to enter a place name. The results (matched places) are
provided as an ADO.NET DataSet to be displayed in a TaskResults control and on
a map. You must provide an ArcWeb Services account to use with the
FindPlaceTask control. Either a Commercial Services or Public Services account
may be used with the FindPlaceTask control. For information on obtaining an
ArcWeb Services account, please visit the
ArcWeb Services page at the ESRI Web site.
Assembly: ESRI.ArcGIS.ADF.Tasks.dll
Class: ESRI.ArcGIS.ADF.Tasks.FindPlaceTask
-
Add supporting controls to the page
In order to take full advantage of the FindPlaceTask control, a number of
supporting controls must be available. Set up a Web application with
MapResourceManager and Map controls
using their discussion topics as a guide. Add a
TaskResults control using that control's discussion topic as
a guide. At runtime, the TaskResults control displays the results of
the FindPlaceTask. Through the TaskReslts control, returned
places are displayed as interactive client-side graphics with map tips (by
default). Users can then interact with the results to change map extent,
display selected features, or re-execute the task. TaskResults also displays a
message to the user while the task executes.
To hide the find place panel at website startup, set the FindPlaceTask.Visible
property to false. To allow the user to call up the form from a link
on the page, add a Menu control from the standard ASP.NET Navigation
tools, and then add a TaskManager
from the ArcGIS Web Controls toolbox group. Set the BuddyControl
property of the TaskManager to the Menu control you added. If you want to
display the find place panel immediately upon application startup,
make sure the FindPlaceTask.Visible property is set to true. Note, a
TaskManager and ASP.NET Navigation control are not required to use the
FindPlaceTask, they are merely designed to assist when using the task at
runtime.
-
Add a FindPlaceTask control
In Visual Studio, display the prepared Web form in design
mode, select the Toolbox, and expand the ArcGIS Web Controls
tab. Drag and drop a FindPlaceTask control into the
TaskManager control, or if you did not add a TaskManager control, just drag the
FindAddressTask onto the page. Your page might resemble the following layout,
which was arranged using a table:

-
Set properties for the FindPlaceTask control
In design mode, click the FindPlaceTask control, which displays the smart
tag arrow in the upper right of the control. Click on this arrow to display the
smart tag menu. This menu displays common properties that you can set, though
others are available in the Properties window for the control.

a. Task results container
Click the first item in the smart tag menu to choose the Task Results
container, or click the TaskResultsContainers property button in the Properties
window. This brings up the BuddyControl collection editor. Click Add to add an
item to the collection. With the TaskResults1 item selected, in the right side
of the dialog, click the drop-down list and select the TaskResults control you
added earlier. This is where the FindPlaceTask displays results that are
found when the user executes a query.

b. Set the task,
ArcWeb source, and results properties
Click the second item in the smart tag menu, "Configure
Task". One dialog with three tabs will be displayed.
-
The General tab will enable you to set the GeocodeResourceManager and
GeocodeResource you want to use with the FindAddressTask. You
can also set the runtime name of the task (as it appears in the ASP.NET
Navigation control), the text of the button in the task to initiate the execute
the task, and a help tip to provide end users with some assistance at runtime
when the mouse cursor hovers over the FindAddressTask
panel (e.g. provide address examples to illustrate input format).

-
The Settings tag enables you to specify the ArcWeb Services account and service
to use and the types of places to search for.
-
In the User Name and Password text boxes, enter a valid ArcWeb Services
account. Visit the
ArcWeb Services
page for information on obtaining an ArcWeb account.
-
After entering account information, click the drop-down list for Service and
choose an ArcWeb service to find places. See the ArcWeb Services
Place Finder Web Service
page for details on each service.
-
Once you choose a service, the columns for Available Places and Search
These Places are populated. Use the arrow buttons between the columns to
enable/disable searching on types of places.
-
Select whether to find places starting with, or exactly matching, the user's
input string.
-
Click OK to set the options and dismiss the dialog.
-
The Results tab enables you to set the render properties of places
(points) returned from executing the FindPlaceTask. A
TaskResults control is required and must be configured as a task results
container for the FindPlaceTask (see additional property
setting discussion below). The TaskResults control must be buddied
with a Map control to view the FindPlaceTask results in the Map.
The Results tab contains two buttons to set the default renderer and
highlight renderer of places returned from a query (the
results). At runtime, place will be displayed in a map as a
graphic feature using the renderers defined in this
dialog. When hovering over a result in the TaskResults control
or a place graphic feature in the map, the respective highlight
renderer will be displayed. The "Show MapTips" check box will
enable MapTips on each graphic feature and display
the fields returned for each place.

Optionally, you can set some of these properties via the properties dialog
in Visual Studio.
-
Setting the position of input form
By default, the FindPlaceTask form appears in a floating window, which
the user may drag to a new position within the Web page. The opening position
does not necessarily correspond to its position on the Web page design form. If
preferred, the query window may be fixed at a specific position.
To fix the position of the query form at a specific location, set the
position style of the FindPlaceTask or a containing control or DIV. To set
the style, switch the Web page from Design view to HTML view in Visual Studio.
Find the FindPlaceTask in the page listing. Insert a style attribute within the
control tag, and set its position properties to specific values. Use
"position:absolute" to set the query form at an exact position on the page. Use
"position:relative" to fix the position relative to its placement to other
controls. In the following example, relative placement is used to ensure the
query window is placed within a table cell:
<td>
<esriTasks:FindPlaceTask style="position:relative;top:5px;left:0px;"
ID="FindPlaceTask1" runat="server" ...>
</esriTasks:FindPlaceTask >
<td>
When fixing the position of the query window, you may want to set the
CloseButton, Draggable, ExpandCollapseButton, HeightResizable
and WidthResizable properties to false to disallow modifying the
find place dialog form. Setting Draggable to false disallows moving the find
place dialog.
Optionally, in design view you can right click on 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 will be displayed in the position defined for the task at design
time.
-
Other properties for FindPlaceTask
Some of the properties you may wish to modify for your application include:
-
Title
: displayed at the top of the query form to the user. You should change this
from the default, which is the ID of the control. Choose a title that describes
what the query does. An example would be, "Find world place".
-
LabelText: Text prompt displayed immediately before the user input
text box. Default is "Find place".
-
ButtonText: Text for the button the user clicks to execute the
query
-
MaxRecords: Maximum number of features found by the query. Default
is 50.
-
FeatureSelectionColor: After query results display, and the
user checks the box next to a feature, the feature is highlighted with this
color on the map.
-
ShowDetailsInTable: Whether to display feature attributes in
the query results for each feature
-
Using the FindPlaceTask at runtime
Using the FindPlaceTask is similar to using the SearchAttributesTask. An
example of the query form the user might see would be:
The user enters a value, then clicks Find. The results are displayed in the
TaskResults control output. See TaskResults
for a discussion and examples of using the results from a query.
Members
Properties
The following table provides a list of properties of
interest. For complete reference information, see the FindPlaceTask
control in the library reference section.
|
Property Name |
Type |
Description |
| ButtonText |
string |
The text which appears on the button to executes the task. |
| DefaultValue |
string |
An optional value which appears in the input box by default. |
| FeatureSelectionColor |
Color |
The Color of selected features. |
| FindPlaceProperties |
FindPlaceProperties |
Displays the Find Place properties dialog for configuring the task. |
| InputWidth |
Unit |
Input field width. |
| LabelText |
string |
The text for the label which appears beside the input box. |
| MaxRecords |
int |
An integer specifying the maximum number of records that the task
will return. |
| GroupResultsByTable |
bool |
Whether the results of this task will have the results grouped by layers. |
| NavigationPath |
string |
The path to the task as it would appear in a hierarchical data control buddied
to the task's TaskManager. |
| ShowFieldAttributes |
bool |
Whether the results of this task will have the field attributes. |
| ShowLegend
|
bool |
Whether the results of this task will have a legend. Legend is only available
if GroupResultsByTable is true. |
| TaskResultsContainers |
BuddyControl Collection |
The controls in which results from this task are displayed.
|
| ToolTip |
string |
The tooltip displayed when the mouse is over the control. |