treeview position maintain in asp.net
<p>Im using Treeview in asp.net</p>

<p>Treeview like</p>

<p>PARENT1</p>

<pre><code>#Child
   .Subchild1
   .Subchild2
</code></pre>

<p>PARENT2
    #child1
    #child2</p>

<p>first when my page load at first time all nodes should be collapsed
like</p>

<p>PARENT1
PARENT2</p>

<p>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....</p>

<p>if i click parent2 vise versa...</p>

<p>so i have to maintain tree position level in every postback
any solution for this?</p>

<p>im using the following code </p>

<p>but i got error
 protected void Page_Load(object sender, EventArgs e)
    {
         if (Session["tvExpandNode1"] != null)
        {
            TreeView1.FindNode(Session["tvExpandNode1"].ToString()).Expand();
        }
    }</p>

<p>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);
                    }
                }
    }</p>
