FindNodeByText - Couple of Questions

2 posts, 0 answers
  1. Silver
    Silver avatar
    25 posts
    Member since:
    Feb 2012

    Posted 21 May 2012 Link to this post

    HI,

    I provided a textbox for user to find tree view nodes. The find functionality is working good, but I have couple of questions

    1. After node.expand() and node.select(), how to make the tree view to load a page which is tied to that node. Each node on my tree view has NavigateURL set to a aspx page.

    2. Is there a way to find the node based on partial value entered? For example if node text is 'Employee Engagements', I want to find the node if user enters 'Employee' or 'Engagements'.. I mean like text.contains..

    Thanks
  2. Plamen
    Admin
    Plamen avatar
    2729 posts

    Posted 24 May 2012 Link to this post

    Hello Silver,

     
    1.You can navigate to the URL of some node as it is done in this code:

    function OnClient(sender, args) {
              var treeOne = $find("<%= RadTreeView1.ClientID %>");
           window.location=treeOne.get_nodes().getNode(0).get_navigateUrl();
            }
     
    2.Here is that code  that shows how to go through all the nodes and select all the files that contain some text:
    function OnClientClicked(sender, args) {
                  var textBox = $find("<%= RadTextBox1.ClientID %>");
                 var treeOne = $find("<%= RadTreeView1.ClientID %>");
                
                  for (var i = 0; i < treeOne.get_allNodes().length; i++) {
                   
                        if (treeOne.get_allNodes()[i].get_text().indexOf(textBox.get_value()) !=-1) {
     
                           treeOne.get_allNodes()[i].select(true);
                        }
                    }
                }
            </script>
            <telerik:RadTextBox runat="server" ID="RadTextBox1">
            </telerik:RadTextBox>
             <telerik:RadButton runat="server" ID="RadButton1" AutoPostBack="false" Text="Select Nodes"
                OnClientClicked="OnClientClicked">
            </telerik:RadButton>
           <telerik:RadButton runat="server" ID="RadButton2" AutoPostBack="false" Text="Navigate"
                OnClientClicked="OnClient">
            </telerik:RadButton>
            <telerik:RadTreeView runat="server" ID="RadTreeView1" MultipleSelect="true">...

    Hope this will help you.

    All the best,
    Plamen Zdravkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top