在TreeView1_SelectedNodeChanged的事件中,获取选择的节点的信息,比如
string aa = this.TreeView1.SelectedValue; //比如aa=2
然后用aa来查找GridView相匹配的数据,比如
this.GridView1.SelectedIndex=int(aa);
或则用一个循环,匹配GridView1中某个字段的值,找到后,选中。
for (int i = 0; i < this.GridView1.Rows.Count; i++)
{
if (this.GridView1.Rows[i].Cells[0].Text == aa) {
this.GridView1.SelectedIndex = i;
break;
}
}