Hi,
I use WebDataTree and I am doing manual load on demand by populating the nodes on NodePopulate event.
I have seen that the event will be fired only once per node.
For example, if I load 3 levels of tree data initially and expand them all, when I expand a node in the third level, the NodePopulate event is fired for it. After this, if I collapse the root level node and expand it again, it fires NodePopulate event even for root level node. Hence I manually load the root's children and similarly it's children. Now in the third level, if I again try to expand the same node which I did earlier, NodePopulate event is not fired for it.
Can anyone tell me if I need to do anything in specific to fix this.
Here is my Tree definition:
<ig:WebDataTree ID="Tree" runat="server" InitialExpandDepth="0" EnableExpandOnClick="false" StyleSetName="Office2010Blue"
InitialDataBindDepth="0" EnableAjax="true" EnableConnectorLines="false" Font-Size="Small" OnNodeDropped="serverNodeDropped">
<AutoPostBackFlags NodeDropped="On" />
<ClientEvents NodeClick="Tree_NodeClick" />
</ig:WebDataTree>
Code behind:
protected void treeNodePopulate(object sender, DataTreeNodeEventArgs e)
{
this.Tree.DataBind();
if (!e.Node.HasChildren)
//Logic to load list of employees under e.Node
foreach (Employee emp in childNodes)
DataTreeNode treeNode = new DataTreeNode();
treeNode.Text = emp.NodeDescription;
treeNode.Key = emp.NodeID;
treeNode.NavigateUrl = emp.NodeURL;
treeNode.ImageToolTip = emp.LevelDepth.ToString();
treeNode.IsEmptyParent = true;
treeNode.ImageUrl = emp.ImageURL;
treeNode.Value = emp.NodeVal;
e.Node.Nodes.Add(treeNode);
}
protected override void OnInit(EventArgs e)
base.OnInit(e);
this.Tree.NodeBound += new DataTreeNodeEventHandler(treeNodeBound);
this.Tree.NodePopulate += new DataTreeNodeEventHandler(treeNodePopulate);
protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack)
// Logic to load the Employee data corresponding to first 3 levels and populate the tree
Hi nancy1985,
Thank you for posting in the community.
From what I can understand, when binding your tree initially, you are setting the isEmptyParent property for its leaf nodes. At a later point the isEmptyParent is also set for the root node, resulting in repopulating the tree. I suggest that you ensurte that the IsEmptyParent property is again set for the leaf nodes at that stage as they are essentially being recreated. It would be helpful to know a bit more regarding how your tree is bound (and when the child nodes' properties are set).
Hope this helps.
Please feel free to contact me if you have any questions regarding this matter.