Hi All,
I have a WebDataTree which I populate in the page_load on the server-side, all works well, but I am getting a problem where the NodeClick event seems to get fired multiple times.
The tree is defined as follows
<ig:WebDataTree ID="wdtCase" runat="server" Height="300px" Width="100%"
EnableConnectorLines="True" onnodeclick="wdtCase_NodeClick"
onselectionchanged="wdtCase_SelectionChanged">
<AutoPostBackFlags NodeClick="On" SelectionChanged="Async" />
<ClientEvents Initialize="InitializeHandler" NodeClick="NodeClickHandler" NodeCollapsed="NodeCollapsedHandler"
NodeCollapsing="NodeCollapsingHandler" NodeExpanded="NodeExpandedHandler" NodeExpanding="NodeExpandingHandler"
NodeHovered="NodeHoveredHandler" NodeUnhovered="NodeUnhoveredHandler" NodePopulated="NodePopulatedHandler"
NodePopulating="NodePopulatingHandler" CheckBoxSelectionChanged="NodeCheckBoxSelectionChangedHandler"
ActivationChanged="NodeActivationChangedHandler" ActivationChanging="NodeActivationChangingHandler"
SelectionChanged="NodeSelectionChangingHandler" SelectionChanging="NodeSelectionChangingHandler" />
<AjaxIndicator AltText="Async post" />
</ig:WebDataTree>
Nothing out of place there, then the NodeClick event is
protected void wdtCase_NodeClick(object sender, Infragistics.Web.UI.NavigationControls.DataTreeNodeClickEventArgs e)
{
// Raise the NodeClick event out.
if(this.NodeClicked != null)
// do stuff here
}
But the event is called multiple times, not just once. Has anyone got any suggestions?
Many thanks
Hi,
when the auto postback flag is On it will do a full postback, while setting it to Async updates only the affected part of the control through an AJAX request.
When you click a node you get fired SelectionChanging and SelectionChanged (because you first select the node) and after that you get NodeClick. If you click again on the same node it will fire only NodeClick because the node is already selected.
Thanks,
Lubomir
Just reporting back, removing the SelectionChanged handler didn't change anything :(
However for future reference, changing NodeClick to Async instead of On for the postback, seems to have cured the problem.
Ignore the this.NodeClicked, that's just a custom event i'm throwing back out of my control, don't confuse that with NodeClicked event from the tree :)
I'll remove the selectionchanged handler and see if that fixes it though, thank you :)
you should not use Auto postback flags for NodeClick and SelectionChanged in the same time, because it will only fire selection changed first and then do an async postback. Also in the event handler you should use e.Node instead of this.NodeClicked. Are you sure the event is not fired for different nodes?