Treeview – checking and unchecking nodes

This code sample demonstrates how to check and uncheck nodes within a Treeview control regardless of what level you are at within the tree. For example, if you check a parent node then all child nodes of that parent will be checked. Likewise, if you have a child node that is not checked and you check it, it’s parent (and it’s parent) will be checked.

The following code is fired via the AfterCheck event of the Treeview control and I have provided both VB and C# samples. The only piece to point out is the use of the RemoveHandler and AddHandler code within the AfterCheck event. This is done to avoid a StackOverflowException being thrown.

VB.NET Sample

C# Sample

 

2 thoughts on “Treeview – checking and unchecking nodes

  1. Olivie

    Hi my name is Olivie and I just wanted to drop you a quick note here instead of calling you. I came to your Treeview – checking and unchecking nodes – djjeavons page and noticed you could have a lot more hits. I have found that the key to running a successful website is making sure the visitors you are getting are interested in your niche. There is a company that you can get targeted traffic from and they let you try their service for free for 7 days. I managed to get over 300 targeted visitors to day to my website. Check it out here: http://msus.me/48um

    Reply
  2. Olivie

    Hi my name is Olivie and I just wanted to drop you a quick note here instead of calling you. I came to your Treeview – checking and unchecking nodes – djjeavons page and noticed you could have a lot more traffic. I have found that the key to running a popular website is making sure the visitors you are getting are interested in your subject matter. There is a company that you can get targeted visitors from and they let you try their service for free for 7 days. I managed to get over 300 targeted visitors to day to my site. Check it out here: http://garye.co/6y

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *