Select to view content in your preferred language

C# Codebehind for FeatureLayer.Update Method/Using as a filter in Sharepoint

806
0
03-26-2013 08:46 AM
RobBennett
Deactivated User
Greetings all

I'm creating an add.in for Sharepoint.  This add.in is using the Update method from the FeatureLayer class.  I can't seem to make it work.  The issue is with the code-behind in C# 
It uses a combo box to select from a variety of attribute values to filter on the selected layer only.

The selected feature layer should update with only the selected attributes.  Thanks in advance for any feedback

Rob


using System.Windows;
using System.Windows.Controls;
using ESRI.ArcGIS.Client;
using ESRI.ArcGIS.Client.Extensibility;
using ESRI.ArcGIS.Client.Tasks;

namespace FilterVesselCategoryCommand
{
    public partial class FilterVesselCategoryDialog : UserControl
    {
        public static Layer selectedLayer;

        public FilterVesselCategoryDialog()
        {
            InitializeComponent();
        }

        public void VesselCategoryComboBox_SelectionChanged(object sender, RoutedEventArgs e)
        {

            ArcGISDynamicMapServiceLayer dynamicLayer = (ArcGISDynamicMapServiceLayer)MapApplication.Current.Map.Layers[0];
            dynamicLayer.DisableClientCaching = true;

            FeatureLayer featureLayer = MapApplication.Current.Map.Layers[0] as FeatureLayer;

            featureLayer.OutFields.Add("*");
            featureLayer.Where = "CATEGORY = '" + VesselCategoryComboBox.SelectedItem.ToString() + "'";

            // Execute update
            featureLayer.Update();
        }
    }
}
0 Kudos
0 Replies