J
Jared
I am using a TreeView with data stored in a database and have been
trying to store a node index over a postback and re-select the node
without using javascript.
I couldn't find anything in these groups to answer my question, so I
thought somebody might find this method useful.
You can use the TreeNode.ValuePath to select a node using the
TreeView.FindNode() method.
Firstly store the value path;
Session["strNode"] = MyTreeView.SelectedNode.ValuePath;
//I am storing in a session variable here.
Then you can deselect your node if you want and carry on with other
tasks, but you can still re-select by running the following.
if (Convert.ToString(Session["strNode"]) != "")
{
TreeNode strNode =
MyTreeView.FindNode(Convert.ToString(Session["strNode"]));
strNode.Select();
Session["strNode"] = "";
}
Hope this is useful.
Jared
trying to store a node index over a postback and re-select the node
without using javascript.
I couldn't find anything in these groups to answer my question, so I
thought somebody might find this method useful.
You can use the TreeNode.ValuePath to select a node using the
TreeView.FindNode() method.
Firstly store the value path;
Session["strNode"] = MyTreeView.SelectedNode.ValuePath;
//I am storing in a session variable here.
Then you can deselect your node if you want and carry on with other
tasks, but you can still re-select by running the following.
if (Convert.ToString(Session["strNode"]) != "")
{
TreeNode strNode =
MyTreeView.FindNode(Convert.ToString(Session["strNode"]));
strNode.Select();
Session["strNode"] = "";
}
Hope this is useful.
Jared