关于winform中treeview重新绑定的问题,在线等`````````````
为什么在修改某一节点名称,并重新绑定该treeview后,界面上的treeview没有任何变化 ? 求一解.代码如下.
每次重新绑定调用的方法 getTreeItemType()
/// <summary>
/// 绑定树
/// </summary>
public void getTreeItemType()
{
treeViewItemType.BeginUpdate();
treeViewItemType.Nodes.Clear();
string sSql = "select ItemTypeID,ItemTypeName from [ItemType] ";
TreeNode tn = new TreeNode();
tn.Text = "材料类别 ";
tn.Tag = string.Empty;
getNodes(tn, sSql, "0 ");
treeViewItemType.Nodes.Add(tn);
treeViewItemType.Nodes[0].Toggle();
treeViewItemType.EndUpdate();
}
/// <summary>
/// 递归读取树结构
/// </summary>
/// <param name= "node "> TreeNode node </param>
/// <param name= "sql "> sql </param>
/// <param name= "parentID "> 上级节点ID </param>
private void getNodes(TreeNode node,string sql, string parentID)
{
DataTable dt = DB.DBTable(sql + " where ParentID = " + Int32.Parse(parentID));
TreeNode tn;
foreach (DataRow row in dt.Rows)
{
tn = n