Select to view content in your preferred language

Featurelayer.Update() doesn't request anything from server

1732
1
11-28-2011 10:30 AM
KirkKuykendall
Deactivated User
I want to load some features into a featurelayer, but Fiddler shows no request when featurelayer.Update() is called. Neither UpdateCompleted nor UpdateFailed get fired.

I'm using SelectionOnlyMode.

Is there some way to load a featurelayer with only the features based on a list of ObjectIDs ?

private void button1_Click(object sender, RoutedEventArgs e)
{
    var fLayer = MyMap.Layers["MyFeatureLayer"] as FeatureLayer;
    fLayer.ObjectIDs = new int[] { 1, 2, 3, 4 };
    fLayer.UpdateCompleted += (s, ea) =>
        {
            Debug.Print(fLayer.Graphics.Count.ToString() + " features selected");
        };
    fLayer.UpdateFailed += (s, ea) =>
        {
            Debug.Print("update failed: " + ea.Error.Message);
        };

    fLayer.Update();
}


<esri:Map x:Name="MyMap" Extent="-130,10,-70,60" Grid.Row="1">
    <esri:Map.Layers>
        <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer"
        Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/>
        <esri:FeatureLayer ID="MyFeatureLayer" Mode="SelectionOnly"
        Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/0" >
        </esri:FeatureLayer>
    </esri:Map.Layers>
</esri:Map>
<Button Content="Button" Click="button1_Click" Height="21" HorizontalAlignment="Left" Margin="58,0,0,0" Name="button1" VerticalAlignment="Top" Width="63" />


Any suggestions would be greatly appreciated, Thanks!
0 Kudos
1 Reply
DominiqueBroux
Esri Frequent Contributor

Neither UpdateCompleted nor UpdateFailed get fired.
I'm using SelectionOnlyMode.


In SelectionOnlyMode, the graphics are never automatically added by executing the query. The graphics have to be added manually (by a selection or by the API).

The other modes (Snapshot, OnDemand) should work. Did you run into issue with others modes?
0 Kudos