开发者

ASP.NET TreeView: return to selected node

开发者 https://www.devze.com 2022-12-14 08:09 出处:网络
I\'m developing an ASP.NET WebForm application with .NET Framework 3.5 SP1 and C#. I have a TreeView on a page. The user can navigate throught its nodes to select one. Then the user can edit the info

I'm developing an ASP.NET WebForm application with .NET Framework 3.5 SP1 and C#.

I have a TreeView on a page. The user can navigate throught its nodes to select one. Then the user can edit the information represented by that node in another page. I want when the user come back to that page the treeview has selected the node that it was selected before.

UPDATE

The user select a node and then click on a asp.net button. Then the user goes to another page. On that other page, the user edit some data and then click on another asp.net button to come back to treeview.

I've tried to save selectednode on session but I need to load all treeview to find that node. It can take a lot of time to load all nodes.

Also, the treeview is loaded on TreeNodeExpanded event and I set its ExpandDepth property to 1. It doesn't开发者_高级运维 have a datasource. I create and add nodes at runtime.

How can I do that?

If you need more details tell me!

Thank you.


Don't know if it's appropriate to your specific requirements, but generally the easiest way of dealing with these kinds of situations is to use a modal popup instead of sending the user to a completely different page.


populate your tree nodes when the page loads first time. and if there is a selected node (in session, querystring, or cookie) select it while populating the tree.

0

精彩评论

暂无评论...
验证码 换一张
取 消