I want to retrieve all, or just some value(s) from a selected row, or multiple, in a TableControl.
Meaning, on click of a button the TableControl is checked for selected rows and based on the result a couple of values, or the values from all fields should be returned.
How can I do that?
Solved! Go to Solution.
I think I found a way, but I am not certain it's the correct one.
Is that as it should be, or do I overcomplicate things?
I think I found a way, but I am not certain it's the correct one.
Is that as it should be, or do I overcomplicate things?
get the selected features into a list with:
var selectedFeatures = ArcGIS.Desktop.Mapping.MapView.Active.Map.GetSelection();
Then iterate through each (it will give you 3 iterations if you have selected features within 3 layers, even if more than 1 item is selected within a layer)
foreach (var selection in selectedFeatures)
{
var inspector = new ArcGIS.Desktop.Editing.Attributes.Inspector();
// The inspector will contain an array of layers (with 1 or more feature in each)
inspector.Load(selection.Key, selection.Value);
foreach (long oneObjectId in selection.Value)
{ var inInsp = new ArcGIS.Desktop.Editing.Attributes.Inspector();
inInsp.Load(selection.Key, oneObjectId);
//you can now use mystring=inInsp["STREETNAME"];
}
}
So, the way I was describing before is the way to go.
Thanks Frederic