Friday 18 October 2019

arcgis 10.0 - Feature Layer Attribute table to Datatable and make it editable


Currently I'm using this to turn it into a data table


 featureCursor = layer.FeatureClass.Search(que, false);
row = featureCursor.NextFeature();


if (row != null)
{
for (int i = 0; i < row.Fields.FieldCount; i++)
{
dataTable.Columns.Add(row.Fields.get_Field(i).Name);
}
while (row != null)
{
dataRow = dataTable.NewRow();


for (int j = 0; j < featureCursor.Fields.FieldCount; j++)
dataRow[j] = row.get_Value(j);

dataTable.Rows.Add(dataRow);
row = featureCursor.NextFeature();
}
}

Does anyone know a more efficient way on doing this.



Also I'm binding the data table to a datagrid, does anyone know a good way I can do this so that I can make the attribute table editable, and values reflected in the feature layer.


I can do this, but not cleanly, has anyone tried this before?



Answer



There is a binding sample from ESRI.


Check it out:


http://edndoc.esri.com/arcobjects/9.2/NET/a6eb84fb-93db-4bc3-82a9-874d8890a8ca.htm


Same sample in ArcGIS 10 documentation


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...