Click here to Skip to main content
16,017,502 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a treeview control on my asp.net page to display information, each node of the treeview has a unique value, I want to do a search for a word in the treeview control, highlight the word and go to the first occurrence of the word, ie set focus to this node. This will normally involve scrolling down the page.

I can do the search through the treeview control and highlight the word but I cant get the focus to be set to this first node.

I have been trying to move to each node through an anchor tag but cant get it to work, any suggestions on how to overcome my problem?

Thanks
Posted
Comments
[no name] 8-Oct-14 22:19pm    
Do you need to give link to each of tag??
garywhiteside 9-Oct-14 5:02am    
I have the anchor tag as part of the text attribute of each node, its just the best way to go to that tag after the page does a post back on a button click, the treeview is inside an update panel also

1 solution

Try linking within the document like this:

If you want to create an anchor called tree-node-name, you simply add this line where you want the anchor to be:

HTML
<a name="tree-node-name">Your node</a>


After doing this, you can make a link pointing to the anchor using the normal&lt;a href tag, like this:
Click
HTML
<a href="#tree-node-name" />


You can access this via link by appending #name to your base page url
HTML
www.your-domain-com/your-page.aspx#tree-node-name
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900