protected void Page_Load(object sender, EventArgs e)
{
if (Session["tn"] != null || Convert.ToString(Session["tn"]) != "")
{
TreeNode tn = (TreeNode)Session["tn"];
ExpandAll(TreeView1);
}
}
protected void TreeView1_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
{
TreeNode tn = e.Node;
Session["tn"] = tn;
}
public void ExpandAll(TreeView tvwExpand)
{
foreach (TreeNode nodExpand in tvwExpand.Nodes)
{
if (nodExpand.Text == ((TreeNode)Session["tn"]).Text)
nodExpand.Expanded = true;
}
}
No comments:
Post a Comment