Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

so i have turned my ITable into an editable DataGridview from this post link.

Now i want to set some of the columns to be non editable. So what I can do is initially set my IFieldEdit.Editable_2 to false, and the column would be read only.

However, when I tried to do that and actually populate values into my field initially, it throws me exception for not editable.

So I was wondering if anyone know if i can temporary set the field to editable and then after setValue , set the editable to false again.

I have this but doesn't work:

bool fieldEditable = featureClass.Fields.get_Field(x).Editable;

IFieldEdit fieldEdit = (IFieldEdit)featureClass.Fields.get_Field(x);
fieldEdit.Editable_2 = true;

featureBuffer.set_Value(x, cegObject.GetPropertyValue(featureClass.Fields.get_Field(x).Name));

fieldEdit.Editable_2 = fieldEditable

However, the setting to true, does not work. Is there a way around this? Or is editable totally useless cause once i make a field editable, i can't even populate a value in? But i'm sure i'm just not doing it right, please help.

Thanks and Regards, Kevin

share|improve this question
add comment

1 Answer

If you create a field which is non-editable via ArcObjects or some other method, you will not be able to edit it (never) without changing the schema, which requires a lock.

I'm not sure if you can revert non-editable fields to editable via ArcObjects.

If you are concerned that a certain user will edit a field by hand, just disable that column on your UI and keep the field editable if you need to insert (calculated) values.

share|improve this answer
    
I've never tried it, but for ArcSDE I wonder if IField.Editable is based on column level permissions as set by the DBMS. If so, maybe granting permissions would change this? –  Kirk Kuykendall Aug 19 '11 at 16:58
    
I don't think ArcSDE grants columns permissions. Maybe Ragi could enlighten us? –  George Nov 17 '11 at 13:00
    
@George no column permissions are used by ArcSDE. The isEditable is a bit that is flipped in the GeoDatabase system tables. If I remember it right, it used to be in the GDB_FIELDINFO table edndoc.esri.com/arcsde/9.1/general_topics/gdbase_sys_tables.htm . I am not sure if this has changed for ArcGIS 10. Nevertheless, George, you are completely right to try to use the ArcObjects with a schema lock first. Then you could go the other route. –  Ragi Yaser Burhum Jul 14 '12 at 21:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.