Home - Forums-.NET - FlyTreeView (ASP.NET) - getting node info after clicking on a button on client

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

getting node info after clicking on a button on client
Link Posted: 08-Oct-2008 04:31
Ken, I have find() function working here. Exactly with the following code: [code]<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestTreeView.aspx.cs" Inherits="TestTreeView" Title="XY Chart" %> <%@ Register Assembly="NineRays.WebControls.FlyTreeView" Namespace="NineRays.WebControls" TagPrefix="NineRays" %> [/code] [code]using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using System.Globalization; using System.Collections.Generic; public partial class TestTreeView : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { initTree(topTree, "top"); initTree(bottomTree, "bottom"); } } protected void topTree_PopulateNodes(object sender, NineRays.WebControls.FlyTreeNodeEventArgs e) { tree_PopulateNodes(e.Node); } protected void bottomTree_PopulateNodes(object sender, NineRays.WebControls.FlyTreeNodeEventArgs e) { tree_PopulateNodes(e.Node); } protected void tree_PopulateNodes(NineRays.WebControls.FlyTreeNode node) { NineRays.WebControls.FlyTreeNode tracknode = new NineRays.WebControls.FlyTreeNode("child1", "child" + System.Guid.NewGuid().ToString()); tracknode.IsCheckbox = true; tracknode.RadioGroup = node.TreeView.ID; node.ChildNodes.Add(tracknode); NineRays.WebControls.FlyTreeNode tracknode2 = new NineRays.WebControls.FlyTreeNode("child2", "child" + System.Guid.NewGuid().ToString()); tracknode2.IsCheckbox = true; tracknode2.RadioGroup = node.TreeView.ID; node.ChildNodes.Add(tracknode2); } private void initTree(NineRays.WebControls.FlyTreeView tree, string name) { NineRays.WebControls.FlyTreeNode devnode = new NineRays.WebControls.FlyTreeNode(name, tree.ID); devnode.PopulateNodesOnDemand = true; tree.Nodes.Add(devnode); } }[/code] May be you just use older version, that doesn't have this function?
Link Posted: 08-Oct-2008 04:39
Probably an older version issue.  The DLL claims it's 4.3.1.54.
It's ok since I'd rather do it with the findAll command in case we decide to implement radio button groups.

ken
Link Posted: 08-Oct-2008 04:55
[quote="kenyee"]Quick suggestion: Using that tree.find() function is non-intuitive.  The tree.getSelectedNodes() function should just return an array of selected nodes no matter whether the tree is in checkbox mode or radiobutton mode...

getSelectedNode function returns selected(focused) node, not checked (no matter radio or checkbox).
Link Posted: 08-Oct-2008 05:08
[quote="EvgenyT"]
getSelectedNode function returns selected(focused) node, not checked (no matter radio or checkbox).


ahh...that makes sense now



" onclick="add()" /> function add() { var tree = CFlyTreeView.getInstanceById(''); var checkedNode = tree.find(function(node) { return node.getChecked(); }); if (checkedNode == undefined) { alert('no node checked'); } else { alert('checked is' + checkedNode.getValue()); } }