I checked the link you have given. its not clear my issue.
Im my code I am reading the selected block reference handle as follows.
ObjectId id = (ObjectId)revIds.GetValue(1);// from nested entity collections
Entity ent = (Entity)tr.GetObject(id, OpenMode.ForRead);
// ... and highlight the nested entity
ent.Highlight(path,true);
if (ent is BlockReference)
{
BlockReference br = ent as BlockReference;
contactName = br.Name;
parentContactID = br.Handle; // getting the handle here
}
Once I got the handle I will update the sabe block reference as follows
ObjectId getParentID = db.GetObjectId(false,handle, 0);
Entity entParent = (Entity)tr.GetObject(getParentID, OpenMode.ForWrite, false);// Use it to open the current object!
if (entParent is BlockReference)
{
BlockReference brParent = entParent as BlockReference;
foreach (ObjectId id in brParent.AttributeCollection)
{
Entity ent2 = (Entity)tr.GetObject(id, OpenMode.ForRead, false);
attRef = (AttributeReference)tr.GetObject(id, OpenMode.ForWrite, false);
if (attRef.Tag == "LOCN")
{
attRef.TextString = "[" + subContactLayer + ":" + subContactPosition + "]";
}
}
}
But it is updating the original bokc attribute also...........................
please replay.