Settings of read-only and hidden fields in ArcGIS Web editing

Source: Internet
Author: User
Tags silverlight

1. Demand Source

During communication with customers, we encountered the following problem: how to set the field read-only or hide some fields when editing element attributes on the Web Side (such as in the Silverlight program?

When I heard this problem, the first reaction was to edit the template for control, but I didn't find a proper place. Today, I asked other colleagues to learn that the layer attribute can be set. So I did the test and it was a success. Thank you, Dr. Zhang from Beijing. 2. Data settings

To edit the data on the web, the data must come from ArcSDE. Select two layers here. One is the geo_sur_ws layer to be edited, and the other is the base map. The layers are as follows:

The map is as follows:

First, Set Properties for the editing layer to hide the bm_l_water field (cancel the check box ):

Then set BM as a read-only field:

The field has been set. To facilitate Web editing, set the editing template:



In the preceding editing template, you can see that the automatically maintained fields (objectid_1, shape, shape) of ArcGIS are as follows. len, shape. area) is not displayed. We have set the hidden field bm_l_water and it is not displayed. Although the BM field is displayed, It is gray, indicating that it cannot be edited.

Save the map document and publish it as the map service. Remember to check the feature access option to use the editing function on the web side.

View the just-released services through the Service Catalog, and you can see the map service and element service: 3 program testing

Next we will test it through a program. In this example, we use the Silverlight API. The XAML code is as follows:

<Grid x:Name="LayoutRoot" Background="White">        <esri:Map x:Name="map">            <esri:ArcGISDynamicMapServiceLayer x:Name="hydroMap" Url="http://esri-huangd/arcgis/rest/services/webedit/MapServer"                                               Token="n_RcVQLbzVGS5ThYnEdpJ8DXzDxyQ3CzLqERelrqlZWfqIdLISVBenN1quJTEDCySBY2mdDZJEqZ19YHGc3MlV2wDj_afN-YQkKlB1EzBMI."/>            <esri:FeatureLayer ID="sur_ws" DisableClientCaching="True" AutoSave="False" OutFields="*" Mode="OnDemand"                               Token="n_RcVQLbzVGS5ThYnEdpJ8DXzDxyQ3CzLqERelrqlZWfqIdLISVBenN1quJTEDCySBY2mdDZJEqZ19YHGc3MlV2wDj_afN-YQkKlB1EzBMI."                               Url="http://esri-huangd/arcgis/rest/services/webedit/FeatureServer/0"/>        </esri:Map>        <esri:EditorWidget x:Name="MyEditorWidget" Map="{Binding ElementName=map}" Width="300" AutoSelect="False" AlwaysDisplayDefaultTemplates="True"             GeometryServiceUrl="http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer" ShowAttributesOnAdd="True" Loaded="EditorWidget_Loaded"/>    </Grid>

The background code is as follows:

private void EditorWidget_Loaded(object sender, RoutedEventArgs e)        {            string[] myLayerIDs = { "sur_ws" };            MyEditorWidget.LayerIDs = myLayerIDs;        }

Compile and run the editor as follows:

Use an editing template to draw a graph. The edit Attributes dialog box is displayed as follows:

After editing, select another element and click the edit attribute button. The edit attribute dialog box is displayed, as shown below:

Careful readers may have discovered that the attribute dialog box automatically popped up when editing elements is different from the one in the pop-up dialog box for separately editing properties: the former has fewer BM fields, that is, read-only fields are not included.

Conclusion: The test shows that you can set the read-only and hidden fields in the Properties dialog box of the layer. If the field is set to hide, the field will not appear in the editing template, and will not appear in the Web-side attribute editing dialog box. If the field is set to read-only, this field will appear in the editing template but it is displayed in gray. On the web side, the attribute dialog box is automatically displayed when the element is edited, the read-only attribute is not displayed. If you select a feature separately and edit the attribute, the read-only attribute is displayed, but it is gray and cannot be edited.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.