Select to view content in your preferred language

Change value of FeatureDataGrid Cell

697
3
11-05-2010 01:42 PM
WilliamKimrey
Emerging Contributor
Hello folks,

I have a featurelayer that I'm editing with a FeatureDataGrid, but I want to change what one of the values says in a ReadOnlyColumn.

More specifically, I'm editing data in a feature class for streets.  Howevr, the name of the street is kept in a separate table and are joined when needed based on a value.  This value is the column that I'm trying to replace.  It shows up just fine in the FeatureDataGrid, but I want to show the name.

I know that a FeatureService can't work with joined tables so I've had to be clever to get the associated names.   Here's what my process is.

1) Use Draw functions to select features in a dynamic layer on the map (using a MapService).
2) Query the MapService based on the geometry of the DrawGraphics.
3) Resulting FeatureSet is used to get a collection of ObjectIDs which are then used to create a WHERE clause for the FeatureLayer. (I also get a unique collection of Name Values)
4) FeatureLayer is updated, selected Streets appear on the map and their information in the FeatureDataGrid.
5) I use the collection of Name Values to get the full name of the Selected Streets.
#Here's my Problem#
6) I want to change the Text in the FeatureDataGrid to display Name of the Street instead of the NameValue.  I know that I can add extra columns that are not bound to the Street Information, so i don't have to actually change any values.  Let's say I add a TextColumn to the beginning of my Columns Collection, and it had placeholder text inside it.  How do I change the text to say "Main Street" for each item in my FeatureDataGrid that represents a portion of Main Street?

Loading_Row event has not been helpful to me, but I suppose I've just missed how to do it properly.  Any help or suggestions would be great.

Thanks,
Will
0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
If you have a related table you need to update, you can update it as you would any FeatureLayer.

For example this FeatureService http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer. It includes a layer with Point geometry and a related table.  The layer's objectid and the table's sf_311_serviceoid field must match.

What you can do is have two FeatureLayer, one for the layer (added to your map layers) and one for the table (not part of map). 

The FeatureLayer for the layer can be updated using FeatureDataGrid. The FeatureLayer for the table can be updated using FeatureDataForm. 

When you select a graphic in the FeatureLayer for the layer or select a row in the FeatureDataGrid, you can update the Where property of the FeatureLayer for the table (i.e. sf_311_serviceoid field = 3973, where 3873 is the graphic.Attributes[layer.LayerInfo.ObjectIDField]).  Call Update() on this layer and in the UpdateCompleted event, set the FeatureDataForm's FeatureLayer and GraphicSource properties.  This should allow you to edit both layer and table simultaneously.
0 Kudos
BingZhu
Deactivated User
Can this be done if a feature (graphic) in the layer has more than one rows associated in the table? Something like an accident location on the map layer may have multiple accidents and I need to edit/add/delete data in accident table.

Thanks!
0 Kudos
JenniferNery
Esri Regular Contributor
Sure that should be possible too. You can create a RecordNavigator control that can navigate through the related records, you can update the FeatureDataForm's GraphicSource so that it may point to the correct record in your table.
0 Kudos