当前位置:编程学习 > JS >>

js如何获取treeview选中节点的值

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace WindowsFormsApplication1{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { this.listBox1.Items.Clear(); foreach(TreeNode x in this.treeView1.SelectedNode.Nodes) { this.listBox1.Items.Add(x.Text ); } } }}
答案:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
this.listBox1.Items.Clear();
foreach(TreeNode x in this.treeView1.SelectedNode.Nodes)
{
this.listBox1.Items.Add(x.Text );
}
}
}
}

上一个:一个简单的JS鼠标单击事件
下一个:js 多参数的传递问题请教

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,