Hi,
Background:
in my asp.net 4.0 app (ajaxified) I reload content of tree on every postback.
Scenario:
2 users load same tree. First two items are ItemA and ItemB, so, user1 right clicks and deletes ItemA, his view is refreshed and he can see that there is no more ItemA. User2 thinks that he doesn't like ItemA he sees (in his already outdated view), right clicks -> Delete and instead of deleting nonexistent ItemA, ItemB gets deleted, because underneath tree was reloaded in Page_Load and context menu's index remained same, but node changed.
I get referenced node id to delete in
protected void tvProjectElements_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e) { }
from e.Node.Value
Suggestion:
Maybe for current (or in general) use case context menus should reference to nodes not by index, but by some internal "node-context menu (item) key"? Or this could be configurable, like setting custom key (most likely same as using custom attributes) or fetch node's DataValueField, anyway, to make them correspond to each other.
Possible workaround:
When I will get back to solving this issue, probably I will give a try to fix this using custom attributes (e.MenuItem.Attributes), setting those in data bound event for each nodes' context menu and checking in ContextMenuItemClick by comparing to e.Node.Value value.
Thanks :)
Background:
in my asp.net 4.0 app (ajaxified) I reload content of tree on every postback.
Scenario:
2 users load same tree. First two items are ItemA and ItemB, so, user1 right clicks and deletes ItemA, his view is refreshed and he can see that there is no more ItemA. User2 thinks that he doesn't like ItemA he sees (in his already outdated view), right clicks -> Delete and instead of deleting nonexistent ItemA, ItemB gets deleted, because underneath tree was reloaded in Page_Load and context menu's index remained same, but node changed.
I get referenced node id to delete in
protected void tvProjectElements_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e) { }
from e.Node.Value
Suggestion:
Maybe for current (or in general) use case context menus should reference to nodes not by index, but by some internal "node-context menu (item) key"? Or this could be configurable, like setting custom key (most likely same as using custom attributes) or fetch node's DataValueField, anyway, to make them correspond to each other.
Possible workaround:
When I will get back to solving this issue, probably I will give a try to fix this using custom attributes (e.MenuItem.Attributes), setting those in data bound event for each nodes' context menu and checking in ContextMenuItemClick by comparing to e.Node.Value value.
Thanks :)