collection_time (Type: esriFieldTypeDate, Alias: Collection Date, Length: 36, Editable: True)
UPDATEDATE (Type: esriFieldTypeDate, Alias: UPDATEDATE, Length: 36, Editable: True)
Graphic.Attributes["DateField"] = null should work.
Are you saying it doesn't? It not, what happens when you try that?
foreach (ESRI.ArcGIS.Client.Graphic g in fl.Graphics)
{
if ((int)g.Attributes["OBJECTID"] == objid)
{
IDictionary<string, object> att = g.Attributes;
if (att["UPDATETIME"] != null)
{
att["UPDATETIME"] = "";
}
if (att["UPDATEDATE"] != null)
{
//UpdateDate is a Date field
att["UPDATEDATE"] = null;
}
if (att["DESCRIPTION"] != null)
{
att["DESCRIPTION"] = "";
}
}
}I think that since you gave a length requirement, a validation exception will be thrown if this is not met. If you made g.Attributes["UPDATEDATE"] = null.
If you remove this length requirement, I think you should be able to set it to a null value without validation exception.
FeatureLayer layer = new FeatureLayer() { Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/0", OutFields = new ESRI.ArcGIS.Client.Tasks.OutFields() { "*" } };
layer.Initialized += (s,e) =>
{
layer.Update();
};
layer.UpdateCompleted += (s,e) =>
{
var graphic = layer.Graphics.FirstOrDefault(g => (int)g.Attributes["objectid"] == 105635);
graphic.Attributes["collection_time"] = null;
};
layer.Initialize();
I guess DateTime is Non-Nullable DataType so setting it to null won't work.
Try setting it to null as follows:
g.Attributes["UPDATEDATE"] = new DateTime?();
g.Attributes["UPDATEDATE"] = null.