TreeView with checkboxes - independent parent and child nodes

Posted by: ECHRLicences on 15 December 2020, 9:53 pm EST

  • Posted 15 December 2020, 9:53 pm EST


    I am using the TreeView control in an ASP.NET Core Project.
    I need to have checkboxes to enable selection of one or many nodes.

    I have followed instructions here: and got the tree view to display properly with checkboxes but I need to have different behaviour regarding the parent / child nodes automatic selection.

    The parent nodes needs to be "checkable" on their own, even if not child node is selected.

    Basically the easiest way would be to disable the "auto checking" relationship between parent and child nodes, and let each node be checked separately. Is there any way to achieve this?

    As an example, if I take the link provided below (, I would like to be able to select "Electronics" without any children for example.

    Thanks for your help
  • Marked as Answer

    Replied 16 December 2020, 7:07 pm EST

    For this, you need to remove the checkbox setting for TreeView and add checkbox by your own using the formatItem event.
    tree.formatItem.addHandler(function (s, e) {
    if (e.dataItem.NewItem) {
    var imgUrl = newImageUrl;
    e.element.innerHTML ={html}

    Now, you need to handle the mousedown event for TreeView and check if the target element is check box or not. If yes, you may perform the action by code what you would like to perform.

    Manish Gupta
  • Replied 13 January 2021, 8:32 pm EST


    Thanks for your reply, I was indeed able to achieve it via formatItem to create the Checkboxes and then handling the onClick event of those checkboxes.

    Some other components providers support this out-of-the-box (like, see CheckChildren) so it would be nice to add it for a future release maybe ?

    Thanks again for your help
  • Replied 14 January 2021, 2:36 pm EST

    Thank you for notifying me that your issue has been resolved using the provided workaround.
    We have forwarded this request to the concerned team with the internal ID 470598.

    Manish Gupta
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels