Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have tree view located in master page. I have hierarchy up to 4th level
category 1
 - inner category 1
    -inner inner category 1
 - inner category 2
 - inner category 3

category 2

and so on...

On clicking category 1 its child node will be opened.

When I click on inner category 2 which link to some page, then that page is executed so tree get refreshed due to post back.

But I want to keep that node active, i.e with some distinguish color then other node.
Posted
Comments
Kuthuparakkal 11-Jan-13 23:01pm    
Use Ajax
Sandeep Mewara 11-Jan-13 23:04pm    
Share the code for this:
When I click on inner category 2 which link to some page, then that page is executed so tree get refreshed due to post back.
You need to stop postback on click of the link. OR not get re-render keeping it in an update panel.
Kuthuparakkal 12-Jan-13 0:42am    
Disable postback and use update panel
navnit.88 12-Jan-13 0:47am    
ok i will try using update panel thank you for answering

1 solution

Keep your TreeView inside an UpdatePanel and also if you are creating the TreeView on Page_Load, keep it inside !IsPostBack check, this will prevent your tree from getting refreshed.

For coloring the selected node, you can use "TreeView1.SelectedNodeStyle.ForeColor", other styles can also be set using SelectedNodeStyle property of TreeView.

Hope it helps..
 
Share this answer
 
v2

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