Im using Treeview in asp.net
Treeview like
PARENT1
#Child
.Subchild1
.Subchild2
PARENT2 #child1 #child2
first when my page load at first time all nodes should be collapsed like
PARENT1 PARENT2
If i expand PARENT1 and click subchild2 as by my senario my page is rediected and parent1 should be expanded and parent2 should be collapsed....
if i click parent2 vise versa...
so i have to maintain tree position level in every postback any solution for this?
im using the following code
but i got error protected void Page_Load(object sender, EventArgs e) { if (Session["tvExpandNode1"] != null) { TreeView1.FindNode(Session["tvExpandNode1"].ToString()).Expand(); } }
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e) { if (TreeView1.SelectedNode.Expanded==true) { Session["tvExpandNode1"] = TreeView1.SelectedNode.Parent.Parent.Value; if (strOpenpage == "Report.aspx") { OpenNewWindow(strOpenpage); } else { Response.Redirect(strOpenpage, false); } } }