Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
850
NodePopulate event fired only once per node
posted

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)

    {

        this.Tree.NodeBound += new DataTreeNodeEventHandler(treeNodeBound);

        this.Tree.NodePopulate += new DataTreeNodeEventHandler(treeNodePopulate);

        if (!Page.IsPostBack)

        {

            // Logic to load the Employee data corresponding to first 3 levels and populate the tree

        }

    }