protected void btnGetSelectedNode_Click(object sender, EventArgs e) { string selectedId = Tree1.SelectedNodeID; if (!String.IsNullOrEmpty(selectedId)) { labResult.Text = "选中的节点:" + Tree1.FindNode(selectedId).Text; } else { labResult.Text = "没有选中节点"; } }
protected void btnGetSelectedValues_Click(object sender, EventArgs e) { string[] nodeIds = Tree1.SelectedNodeIDArray; if (nodeIds.Length > 0) { StringBuilder sb = new StringBuilder(); foreach (string nodeId in nodeIds) { sb.AppendFormat(" {0}", Tree1.FindNode(nodeId).Text); } labResult.Text = "选中的节点:" + sb.ToString(); } else { labResult.Text = "没有选中节点"; } }