We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Search Capability in TreeView

Hello All, My Requirement is to include a search functionality inside a TreeView. Can anyone suggest some options in Essential TreeViewAdv which will help me in this regard. Thanks in Advance. Regards Vinay.

6 Replies

AD Administrator Syncfusion Team August 2, 2005 04:31 PM UTC

Hi Vinay, The best way to search TreeViewAdv is a simple recursive function that you pass the TreeViewAdv.Nodes collection into. public TreeNodeAdv FindNodeByText(TreeNodeAdvCollection nodeCollection, string text) { if (nodeCollection == null) { return null; } foreach (TreeNodeAdv node in nodeCollection) { if (node.Text = text) { return node; } else { TreeNodeAdv tempNode = FindNodeByText(node.Nodes, text); if (tempNode != null) { return tempNode; } } } return null; } Regards, Gregory Austin Syncfusion Inc.


SS Scott Swartz June 29, 2009 03:58 PM UTC

Other than one compile issue, that worked great:

Note that:
if (node.Text = text)

should be:
if (node.Text == text)

You guys should really look at making this a method.


FS Fathima Shalini P Syncfusion Team July 1, 2009 12:22 PM UTC

Hi Scott,

Need a method to find the TreeNodeAdv using its text

On our initial analysis we have found that the above issue could be a feature request. We have forwarded this to our developers for more analysis. We will getback to you on or before July 1st 2009.

Please let me know if you have any concerns.

Regards,
Fathima


FS Fathima Shalini P Syncfusion Team July 1, 2009 12:24 PM UTC

Hi Scott,

Thank you for your update.

Need a method to find the TreeNodeAdv using its text

On our initial analysis we have found that the above issue could be a feature request. We have forwarded this to our developers for more analysis. We will getback to you on or before July 8th 2009.

Please let me know if you have any concerns.

Regards,
Fathima


SS Scott Swartz July 1, 2009 01:34 PM UTC

Note that in the end I wrote a method that find's the node based on it's path. It takes a string path and string dellimiter. I had to do this because in my tree some of the leaves have the same name.


FS Fathima Shalini P Syncfusion Team July 2, 2009 09:56 AM UTC

Hi Scott,

Thank you for your update.

I have forwarded your request to our developers. We will get back to you on or before July 8th 2009.

Please let me know if any concerns.

Regards,
Fathima

Loader.
Live Chat Icon For mobile
Up arrow icon