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
270
How to get parent nodes selected base on childs selected nodes
posted

Hello!

I have two WebDataTrees in the same page, where I have to pass nodes from WebDataTree1(Select Data) to WebDataTree2(Selected Data). Then I have a button to save the the selected data in the database. It works fine, I'm using checkbox with TriState.

The problem is when I retrieve this data from the database, I have to repopulate the WebDataTree2 and check the nodes, so I make a "foreach" and check the nodes, but the parent nodes isn't getting checked.

I'd like to know how to select parent nodes as it happens when you click in a child checkbox and the parents get checked. Note that I have around 5 levels in the hierarchy of WebDataTree.

Thanks.

  • 2895
    posted

    Hello Jorge,

    Thank you for using our community.

    I have investigated your case and I would like to suggest you the following approach. You can set the Parent’s check state to Checked or Partial. If all of the children nodes are checked use

    node.ParentNode.CheckState = Infragistics.Web.UI.CheckBoxState.Checked;

    And when only few of the children nodes are checked use:

    node.ParentNode.CheckState = Infragistics.Web.UI.CheckBoxState.Partial;

    Please let me know how my suggestion work for you.