tags:

views:

29

answers:

1

i have a texbox and a treeview. i want the user to search in the treeview by typing in the textbox. i think the best way to do it is using JQuery.
how can i search for a word inside a treeview , color it, and focus on it using JQuery?
a simple example would be great...

i am using ASP TreeView. Sample code for my TreeView is:

 TreeNode n = new TreeNode();
    n.Text = "scatman";
    TreeNode q = new TreeNode();
    q.Text = "hehe";
    n.ChildNodes.Add(q);
    TreeNode q3 = new TreeNode();
    q3.Text = "blabla";
    n.ChildNodes.Add(q3);
    TreeNode t = new TreeNode();
    t.Text = "test";
    q.ChildNodes.Add(t);
    TreeNode n1 = new TreeNode();
    n1.Text = "lol";
    t.ChildNodes.Add(n1);
    TreeNode p = new TreeNode();
    p.Text = "daddy";
    TreeView1.Nodes.Add(n);
    TreeView1.Nodes.Add(p);
    TreeNode s = new TreeNode();
A: 

If you would search html content,in your treeview.
I think this highlight & search jquery plugin will be helpful

Myra

Myra
Indeed,It is an html element..Searching is for content ,not html markup,so if you found the content means you found outline-element
Myra
how can i set focus to the highlighted text?
hero
You should ask that in another question,Also think about that if you highlighted multiple content and you have the ability to focus content,which one of the content you've highlighted will you focus?
Myra
mm i c. 1 more question: in the case of my treeview. i can neither highlight "test" nor "lol" but i can highlight everything else. any idea y this is happening?
hero
I'm sorry but I dont have any ideas,I see that you are new in this site.If you have found your solution with my answer,you should accept it by clicking check button beneath vote button or/and vote.
Myra