Select to view content in your preferred language

Update the Feature layer Issue

749
1
05-24-2012 01:19 AM
ManojrajTeli
Deactivated User
I have been trying to update the Feature layer and bind it to the FeatureDataGrid on Button Click event but when I try to execute following Code the Feature just disappear and FeatureDataGrid Header row is get update and no rows are shown.Thank you in advance and please help me out bcoz i am trying this from last 6 months.
            string type = "Capacity";
            FeatureLayer lyr = Map.Layers["Reservoirs"] as FeatureLayer;
            lyr.ClearGraphics();
             lyr.Url = "http://Dummy/ArcGIS/rest/services/Dummy/FeatureServer/3";
             yr.Where = "Res_Type = 'GLR'";
             lyr.OutFields.Add("*");
             lyr.Update();
            System.Windows.Data.Binding bind = new System.Windows.Data.Binding();
            bind.ElementName = "Map";
            bind.Path = new PropertyPath("Layers.[Reservoirs]");
            MyDataGrid1.SetBinding(ESRI.ArcGIS.Client.Toolkit.FeatureDataGrid.GraphicsLayerProperty, bind);
            MyDataGrid1.UpdateLayout();
0 Kudos
1 Reply
DominiqueBroux
Esri Frequent Contributor
I don't think you need a binding, you can simplify your code with something like:

MyDataGrid1.GraphicsLayer = lyr;

Sidenote concerning your code:
            FeatureLayer lyr = Map.Layers["Reservoirs"] as FeatureLayer;
            lyr.ClearGraphics();
             lyr.Url = http://dummy/ArcGIS/rest/services/Dummy/FeatureServer/3;


The Url of a FeatureLayer can't be set after the layer has initialized. So either your layer is not initialized and ClearGraphics is not useful, or the layer is initialized and setting the Url is not allowed.

That being said, I am not sure that can explain your issue. If you still run into the same issue, I suggest you use fiddler to look at the request sent to the server and to check that some features are returned.
0 Kudos