help needed...

413
2
10-14-2010 04:19 AM
Engr__RizwanAlvi
New Contributor
hi everybody,

I am creating a new featurelayer at runtime, setting its url and other properties. After adding it to the map control, I give this graphicslayer object to featuredatagrid and update the layout.

FeatureLayer f1 = new FeatureLayer();
f1.Url = "http://myserver/ArcGIS/rest/services/abc/MapServer/15";
MyDataGrid.GraphicsLayer = f1 as GraphicsLayer;
MyDataGrid.UpdateLayout();

problem is that graphic layer is added to the map and featuredatagrid is showing number of counts but there are no rows and columns showing...
means data is now showing...

I will appreciate your help.

Thanks in advance.
rizwan
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
You need to set OutFields. FeatureDataGrid need to know which fields need to be displayed and that is controlled by the layer's OutFields.
  private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
  {
   FeatureLayer layer = new FeatureLayer()
   {
    Url = "http://serverapps.esri.com/ArcGIS/rest/services/California/MapServer/8"
   };
   layer.OutFields.Add("*");
   MyMap.Layers.Add(layer);
   MyDataGrid.Map = MyMap;
   MyDataGrid.GraphicsLayer = layer;
  }
0 Kudos
Engr__RizwanAlvi
New Contributor
Thanks a lot.
Its done, now its working...
regards
0 Kudos