asp.net4.0中treeview重复点击节(不是连续)时,只触发一次selectednodechanged事件
如题,这是我的代码
protected void Page_Load(object sender, EventArgs e)
{
lbld.Text = DateTime.Now.ToString();
if (!IsPostBack)
{
Gettree();
}
}
public void Gettree()
{
foreach (DataRow dr in omcbll.Getorgunit().Tables[0].Rows)
{
TreeNodeCollection tree = TV.Nodes;
TreeNode tr = new TreeNode();
tr.Text = dr["c_name"].ToString();
tr.Value = dr["c_code"].ToString();//c_oid_orgunit
/*tr.NavigateUrl = "";*/
//javascript :void(0)
TV.Nodes.Add(tr);
//getNodes(tr, dr["c_code"].ToString());
}
}
public void getNodes(TreeNode nodel, string prenetid)
{
DataSet ds = omcbll.Getunitzi(prenetid);
if (ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
TreeNode tree = new TreeNode();
tree.Text = dr["c_name"].ToString();
tree.Value = dr["c_code"].ToString();
//tree.NavigateUrl = "//javascript :void(0)";
nodel.ChildNodes.Add(tree);
//getNodes(tree, dr["c_code"].ToString());
}
}
}
protected void TV_SelectedNodeChanged(object sender, EventArgs e)
{
getNodes(this.TV.SelectedNode, this.TV.SelectedNode.Value);
}
------解决方案--------------------
点击是click,节点没有改变,当然不会重复处罚SelectedNodeChanged事件了,除非你切换到了不同的节点才会触发SelectedNodeChanged