Select to view content in your preferred language

How to make any attribute field read only?

3314
3
12-01-2010 04:37 AM
SanajyJadhav
Deactivated User
Hi,

I am bit stuck in one issue.

I am having editing capability in my apps.Whenever any new feature is created in the apps, I am assigning a randomly generated unique value to its one of fields, field name is "CUST_FID". But, whenever that feature is created, its feature data from is displayed and its CUST_FID field is also available for edits to user.

Now, I cannot ask my users not to touch this field.They would eventually manipulate that field value.And if it happens, there would be no gurranty that value in that field is going to be unique.

I tried keeping visibility of that field off so that it would not appear in feature data from in Silverlight application.But, when I tried to access that field and its value in my ArcObjects code, it cannot find that value.It just throws error.

So, can anybody tell me that is there any provision by which certain fields can be made READ ONLY or something like that.That way, users won't be able to edit the value in that field and that field can be accessed in ArcObjects?

Regards,
Sanjay.
0 Kudos
3 Replies
nakulmanocha
Esri Regular Contributor
Did you use the OutFields property of FeatureLayer to make the particular field invisible?
0 Kudos
JenniferNery
Esri Regular Contributor
The FeatureDataForm or FeatureDataGrid display fields as "read-only" if the service have marked them as Editable=false. They use OutFields property to know which fields to display to the user.

http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.FeatureLay...

You should still be able to edit "CUST_FID" if it is a field in your layer.

graphic.Attributes["CUST_FID"] = GetUniqueID(); //this works
but because "CUST_FID" is not part of your OutFields, it's current value will not be returned and FeatureDataForm will not display this field.
0 Kudos
SanajyJadhav
Deactivated User
Jennifer and Nakul,

Thanks for your help and suggestions.I would try this and put my results here.I really appreciate your help.

Sanjay.
0 Kudos