日期:2014-05-18 浏览次数:20873 次
protected void TreeViewType_SelectedNodeChanged(object sender, EventArgs e) { TreeView tree = sender as TreeView; if (tree != null) { TreeNode node = tree.SelectedNode; if (node != null) { if (node.Value == "-1") model = 1; else if (node.Parent != null && node.Parent.Value == "-1") model = 2; else if (node.Parent != null && node.Parent.Value == "-2") model = 3; else { TreeNode pNode = node; string strValue = null; do { strValue = pNode.Value; pNode = pNode.Parent; } while (pNode.Value != "-1"); int.TryParse(strValue, out year); model = 4; } } this.MyGridView1.OnBind(); } }
------解决方案--------------------
冒似WPF中的TREEVIEW节点没有VALUE吧
楼主问的与我这里:
http://topic.csdn.net/u/20081023/15/9a1bf5c6-9e19-4642-ae56-930bdc05466c.html
的大同小异
解决了互相给个通知呀^_^