Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8901

Can I change a value of a property in a TreeNode in a DocumentEvents.Update.Before event?

$
0
0
A specific field in the TreeNodes we are using needs to be unique among its siblings. To ensure that it is unique, I'm trying to change the values of a field in a TreeNode when the user changes and saves it. This causes the save event to fire again, which calls my event handler, which fires the event again. It is an undesired loop.Is there a way to update the treenode, without firing the update event?The only way I could think of is performing an sql query directly to the database, but I hope there's a better way.TreeNode.SubmitChanges(false); and TreeNode.Update(); both fire the DocumentEvents.Update event, so that did not solve the problem.I don't see any differences between the DocumentEventArgs when the event is fired from the Kentico User Interface or when it is fired from my C# code.Event handler call:DocumentEvents.Update.Before += uniquePageAliasModule.EnsureUniquePageAliasOnUpdate; Event handler implementation:treeNode.SetValue((Metadata.MetadataPageUrlPath), path); treeNode.SubmitChanges(false); Desired: Save the changes to the TreeNode and do not fire the DocumentEvents.Update eventActual: Saves the changes to the TreeNode and fires the DocumentEvents.Update event

Viewing all articles
Browse latest Browse all 8901

Trending Articles