Hi all,
I have subscribed to AttributeValueChanged event of the Graphic of my editable feature layer.In this event, I want to the change the attribute value of another field.
I would clarify it bit more.Say, this event is fired for a field, VILLAGE_NAME.Then, in this event, I want to modify the value of another field, i.e. MIS_LINK of the same feature layer. I change it in my code and call FeatureLayer::SaveEdits().
But, the problem is, the value of another field, i.e. MIS_LINK is not getting changed.It is still the old value.Another thing that I noticed is, if I change the value of the same field (the field for which event was triggered), it is getting changed.
So, I am confused.Does this mean that we could alter the value of the field, only for which the event AttributeValueChanged gets triggered?
I would appreciate any help on this issue since this functionality is very important for integrity of our data. I have pasted my code below.
[PHP] #region Village_Name
//if user changes the Village_Name, then admin_code has to be changed accordingly.
if (editFeatInfo.EditedFieldName.ToUpper() == "VILLAGE_NAME")
{
//iterate thru the graphics collection and get the desired graphics
foreach (Graphic prclGraphics in prclsLyrGraphicList)
{
if (Convert.ToInt64(prclGraphics.Attributes["OBJECTID"]) == editFeatInfo.ObjectID)
{
clickedGraphicsForAttrEdit.AttributeValueChanged -= (clickedGraphicsForAttrEdit_AttributeValueChanged);
string adminCode = commConst.ADMIN_CODE_UNDEFINED;
string misLink = commConst.MIS_LINK_UNDEFINED;
//get the admin bndry code for this feature
if (prclGraphics.Attributes["ADMIN_BND_ID"] != null)
{
if (prclGraphics.Attributes["ADMIN_BND_ID"].ToString().Length > 0)
{
adminCode = prclGraphics.Attributes["ADMIN_BND_ID"].ToString();
misLink = adminCode + editFeatInfo.NewAttrValue;
//THIS VALUE,I HAVETO CHANGE...
prclGraphics.Attributes["MIS_LINK "] = misLink;
break;
}
}
}
}
clickedGraphicsForAttrEdit.AttributeValueChanged += (clickedGraphicsForAttrEdit_AttributeValueChanged);
prclFeatLyr.SaveEdits();
return;
}
#endregion VIALLGe_NAME[/PHP]
Thanks,
Sanjay J.