Rank: Member Groups: Member
Joined: 11/21/2008 Posts: 15
|
Hello,
Please help me. I’m trying to select a TreeNode in code. I know the path to the treenode, for example node1/node2/item1 and I know the ID (item1) how can I make sure the treeview is expanded so that item1 is visible and how can I select item1 ?
Best regards, Amiran
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You can do it either on the server side or client side. On the server side you can do something like this:
Code: C#
EO.Web.TreeNode node = (EO.Web.TreeNode)TreeView1.FindItem(path);
if (node != null)
{
node.Selected = true;
node.EnsureVisible();
}
On the client side you can do something like this:
Code: JavaScript
var treeView = eo_GetObject("TreeView1");
var node = treeView.findItem(path);
if (node != null)
{
treeView.setSelectedNode(node);
node.ensureVisible();
}
Hope this helps. Thanks
|