EditorTask control


In this topic


Local (DCOM) connections are only supported for ArcGIS for Server versions prior to 10.1.

About the EditorTask control

The EditorTask control has a suite of tools for Web-based editing of feature layers in ArcGIS for Server map services. The run time dialog box provides tools to modify, add, and remove feature geometry and attributes. The EditorTask can also be customized and extended to filter attributes, manage tools, handle events during the editing process, and manage panels. For more information, see Customizing the EditorTask control.
The following set of requirements applies to the EditorTask capabilities:
  • The EditorTask requires an ArcGIS for Server local map service.  
  • The ArcGIS for Server map service can be pooled or non-pooled.
  • The map service must host a map document (MXD). Map service definition (MSD) based services are not supported. 
  • Versioned and non-versioned layers can be edited in non-pooled services, while only non-versioned layers can be edited in pooled services. At run time, the Editor panel contains a set of subpanels containing different items depending on the purpose and feature type being edited. Editing non-versioned data changes the availability of some commands on the Editor panel. When using non-versioned data with a pooled service, the Editor panel will not contain Undo, Redo, or Save buttons for pooled services. When using non-versioned data with a non-pooled service, the Undo and Redo buttons are not available. Undo and redo are capabilities of a versioned geodatabase. The Save option is a capability defined by a non-pooled service.    
  • While the map service can contain many different data types, editable layers for the EditorTask must be ArcSDE enterprise or workgroup layers. 
  • Shapefiles and personal geodatabases cannot be edited with the EditorTask, but they can be used for other operations, such as snapping. 
  • The data frame in the map service that contains an editable layer cannot be projected on-the-fly by the Web Application Developer Framework (ADF) or projected in the .mxd file.  
  • If more than one feature layer shares the same name in a map service, only one is editable. Assign each editable layer in a map service a unique layer name.

Using the control

  1. To use the EditorTask control, add supporting controls to the page. Set up a Web application with, at minimum, a  MapResourceManager and Map control. Other controls can be added, such as a Toolbar control for zooming and panning operations.
  2. Add the EditorTask control to the page. For the steps in this topic, the EditorTask does not need to be contained within a TaskManager control. If using the Web Mapping Application template, a TaskManager is used to handle the opening of the task from the left-hand console list of tasks. The page does not need a TaskResults control, since the EditorTask does not create an output of results. The EditorTask inherits from the FloatingPanel and automatically appears in a floating window at run time.

    See the following screen shot that shows the page in Visual Studio:


  3. Set the properties for the EditorTask control. You can access the required properties from the smart tag menu by hovering the cursor over the right side of the EditorTask control. Click the arrow to expand the smart tag menu. Alternatively, you can set the properties using the Properties window for the control.

    See the following screen shots that show the Properties window and the smart tag menu options:


    1. Click Select Resource To Edit on the smart tag menu or on the Properties window, click the ellipsis button for the MapResource property. The Select Map Resource Editor dialog box appears.

      See the following screen shot that shows the Select Map Resource Editor dialog box:



      On the Select Map Resource Editor dialog box, click the drop-down arrow to select the previously added Map control. Select a service from the Resource drop-down list. If no services appear in this list, check that an ArcGIS for Server local resource is in the MapResourceManager and that the resource references a service that hosts a .mxd map document (MSD-based services are not supported). 
    2. Click Select Editable Layers on the smart tag menu in the EditorTask control or on the Properties window, click the details button for the EditableLayers property. The Select Editable Layers Editor dialog box appears. It can take time for the dialog box to find the editable layers, during which time the dialog box information is unavailable. When the available layers are found, the Select Editable Layers Editor dialog box appears with available information.

      See the following screen shot that shows the Select Editable Layers Editor dialog box:



      If no layers appear in the list, verify that the map service is using ArcSDE layers. If multiple ArcSDE databases have been added to the map service, use the Database drop-down list to select the one you want to use. Also, if a versioned geodatabase is used in the map service, you can select to edit as versioned or as unversioned. If you select unversioned, only layers not set as versioned can be enabled for editing.

      The "Layers not available for editing" area on the Select Editable Layers Editor dialog box lists layers that you can enable for editing. Click a layer to highlight it, then click the arrow (>>) button to move it to the Editable Layers area. Only layers in the Editable Layers list will be available for editing.
    3. Click Select Editable Versions on the smart tag menu or on the Properties window, click the details button for the VersionIDs property. Set this item if you are using a versioned ArcSDE database. If editing an unversioned database, this option is not available. The Select Editable Versions Editor dialog box appears.

      See the following screen shot that shows the Select Editable Versions Editor dialog box:



      Available versions are shown under the "Versions not available for editing" area. To make versions available to users, click a version, then click the arrow (>>) button to move it under the Editable Versions area. Only versions appearing under the Editable Versions area are available to users.
    4. By default, no snapping is used when editing. Snapping forces a click near an existing feature to be set exactly on a part of the nearby feature. This allows features to exactly coincide along their borders. To add snapping to the application, click Set Snapping Rules on the smart tag menu or on the Properties window click the details button for the Snapping property. The Set Layer Snapping Editor dialog box appears.

      See the following screen shot that shows the Set Layer Snapping Editor dialog box:



      The Set Layer Snapping Editor dialog box shows all layers that can be enabled for editing, even if the layers have not been added to the editable layers list. This is because snapping can occur across layers. For example, if you enable snapping to a parcels layer and are adding a new building feature, new vertices can be snapped to a parcel within the snapping tolerance.

      The following snapping types are available:
      • Vertex—Snapping occurs to x,y points defining the shape of a feature. 
      • Edge—Snapping can occur anywhere along a feature.
      • End—Snapping occurs to the endpoints of a feature.
       
      See the following illustration that shows the snapping types:


  4. Filter attributes for display and interaction. You can use the AttributeDisplay property to define the fields in each editable layer that are hidden, read-only, or editable at run time. On the Properties window, click the ellipsis button next to the AttributeDisplay property. The Attribute Display Editor dialog box appears. To set the appropriate properties on each field, select from the editable layers to display the layer fields. By default, all fields are editable (optional). 

    See the following screen shot that shows the Attribute Display Editor dialog box:


  5. Applications using an ArcGIS for Server local resource must contain an ArcGIS identity to enable use of the resource. To add an identity, right-click the Web application in the Solution Explorer, and click Add ArcGIS Identity. The Add ArcGIS Identity dialog box appears. On the dialog box, type the user name, password, and domain or machine name. Click OK to insert the identity, which is stored in the web.config file of the application.

    If an appropriate identity is not added to the application, an error, such as "An object reference is not set to an instance of an object" can appear when you start the Web application.
  6. For more information about using the EditorTask, see the Web Mapping Application Help system in Visual Studio. Do the following to access a copy of this Help system when you create a Web site in Visual Studio:
    1. To create a Web site in Visual Studio, click File, New, Web Site, then choose the Web Mapping Application template. If you already have a Web site created, see Step b.
      • You can also create a Web site from the ArcGIS Server Manager or ArcIMS Web Manager. In either case, a Help folder is included in the Solution Explorer for the Web site.
    2. Right-click the Default.htm or EditorTask.htm file in the Solution Explorer, then select View in Browser.
    3. Click Editing data on the Web Mapping Application Help page to open the Editing data Help page. 
      • The EditorTask can create ADF graphics layers to manage client interaction at runtime. Remember this when traversing map resources used by the map. 
      See the following screen shots that show the Web Mapping Application Help page and the files in the Solution Explorer:

Members

The following table shows a list of properties related to the EditorTask control. For more information, see the EditorTask control in the library reference section.
Property name
Type
Description
AttributeDisplay
AttributeDisplay
Defines the display properties of attributes in editable layers at run time. At design time (in Visual Studio), this property shows a dialog box to modify field properties.
ConflictLevel
ConflictLevel
How conflicts are defined when a second user edits the same feature (row), or only when editing the same attributes of a feature (column).
ConflictResolution
ConflictResolution
Whether conflicting features are replaced by their representations in the target version or the current edit session.
CreateNewFeatureTitle
string
Text title of the section for creating features.
EditableLayers
StringList
List of the layer IDs for all layers editable by the Editor.
EditAttributesTitle
string
Text title of the section for editing feature attributes.
EditExistingFeatureTitle
string
Text title of the section for modifying the geometry and position of features.
EditorSettingsTitle
string
Text title displayed in the section for changing edit settings for snapping and feature selection.
EnableChangeSettings
bool
Determines if you can change edit settings for snapping and feature selection.
EnableEditAttributes
bool
Determines if you can change attributes for features.
EnableEditExistingFeature
bool
Determines if you can modify the geometry or position of existing features.
EnableNewFeatureCreation
bool
Determines if you can add new features.
FeatureHighlightColor
Color
Color used to highlight the feature selected for attribute editing.
FeatureSelectionColor
Color
Color to highlight features when selected by the user.
FeatureSelectionMode
FeatureSelectionMode
How features are selected with the SelectFeature tool.
MapResource
string
Map resource to be edited.
NotifyOnConflicts
bool
Whether to show a notification message when conflicts are detected and resolved while saving edits.
SelectionLimit
int
Maximum number of features you can select.
SelectionTolerance
int
Distance, in pixels, when clicking to select features or vertices, that the cursor can be from an object and still be selected.
ShowFeatureHighlight
bool
Indicates if the feature whose attributes are shown in the attribute editor panel should be highlighted.
ShowSnapCircle
bool
Whether to show a circle around the cursor indicating the snapping distance.
Snapping
StringList
Snapping rules to use when editing.
SnapTipColor
Color
When you use a tool with snapping enabled and press S on the keyboard, a marker displays with this color at the location snapped to.
SnapTolerance
int
Pixel distance where snapping to a feature occurs.
TaskResultsContainers
BuddyControlCollection
Controls in which results from this task display.
Title
string
Text shown on the Editor task window's title bar.
VersionIDs
StringList
List of all versions editable by the Editor. If the editable layers are unversioned, this property is ignored.
VertexColor
Color
Color of vertices when shown by the user.

EditorTask events

The following table shows a list of events related to the EditorTask control. For more information, see the EditorTask control in the library reference section.
EditorTask event type
Description
EditorPanelsCreated
Occurs when the editor panels (create feature, edit feature, edit attribute) are created. Can be used to add a custom panel to the main EditorTask panel.
PostAttributeEdit
Event fired when an attribute edit has completed.
PostCommandExecute
Editor command that completed execution of its server action.
PostToolExecute
Editor tool that completed execution of its server action.
PreAttributeEdit
Event fired when an attribute edit is being made. It can be used for input validation or cancellation of the edit.
PreCommandExecute
Editor command about to execute its server action.
PreToolExecute
Editor tool about to execute its server action. Allows you to target specific edits and possibly abort, based on your criteria or logging.
SettingsPanelsCreated
Occurs when the Settings panel is created (when the Settings link in the main EditorTask panel is clicked). Can be used to add a custom panel to the Settings panel.
SetVersion
Fired when a version is selected from the version list. The version of the layers in the workspace being edited are set to the selected version.
ToolsCreated
Occurs when the tools in an existing toolbar and Editor panel are created. Can be used to add a custom tool to an existing toolbar.

Editor events

The following table shows a list of events related to the Editor class. For more information, see the Editor class in the library reference section.
Editor event type
Description
LayerChanged
Occurs when the current edit layer changes by the drop-down list in the Editor or when setting the geodatabase version. Can be used to interact with the edit layer via the ArcObjects IFeatureLayer interface.

EditorTask event arguments

The following table shows a list of event arguments related to the EditorTask control. For more information, see the EditorTask control in the library reference section.
EditorTask event argument type
Description
EditorPanelsCreatedEventArgs
Created when the EditorPanelsCreated event occurs. Provides access to the existing panels on the main EditorTask panel.
PostAttributeEditEventArgs
Created when the PostAttributeEdit event occurs. Provides access to the feature and dataset that was edited.
PostCommandExecuteEventArgs
Created when the PostCommandExecute event occurs. Provides access to the editable feature layer and server context.
PostToolExecuteEventArgs
Created when the PostToolExecute event occurs. Provides access to the editable feature layer and server context.
PreAttributeEditEventArgs
Created when the PreAttributeEdit event occurs. Provides access to the feature and dataset being edited.
PreCommandExecuteEventArgs
Created when the PreCommandExecute event occurs. Provides access to the editable feature layer and server context.
PreToolExecuteEventArgs
Created when the PreToolExecute event occurs. Provides access to the editable feature layer and server context.
ToolsCreatedEventArgs
Created when the ToolsCreated event occurs. Provides access to the toolbars in the EditorTask.


See Also:

Customizing the EditorTask control
Sample: Common custom EditorTask
Web ADF controls




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.ArcGISServer.Editor.dll