protected void treeList_Callback(object sender, TreeListCustomCallbackEventArgs e) { ASPxTreeList tree = sender as ASPxTreeList; if (e.Argument.ToString() != "" && e.Argument.Length > 1) { hiddenIdEmp.Value = e.Argument.ToString().Substring(1); string idEmp = e.Argument.ToString().Substring(1); decimal UnitPerentId = 0, UnitChildId = 0; UnitChildId = objEmployees.GetEmployees(Convert.ToInt32(idEmp)).unitid; UnitPerentId = objUnit.GetUnit(objEmployees.GetEmployees(Convert.ToInt32(idEmp)).unitid).parentid; foreach (TreeListNode nodeParent in tree.Nodes) { if (Convert.ToDecimal(nodeParent.Key.Substring(1)) == UnitPerentId) { nodeParent.Expanded = true; foreach (TreeListNode p in nodeParent.ChildNodes) { if (p.Key.Contains("u")) { if (p.Expanded) { p.Expanded = false; } if (Convert.ToDecimal(p.Key.Substring(1)) == UnitChildId) { p.Expanded = true; foreach (TreeListNode c in p.ChildNodes) { if (Convert.ToDecimal(idEmp) == Convert.ToDecimal(c.Key.Substring(1))) { c.Expanded = true; c.Focus(); } } } } } } else { if (nodeParent.Expanded) { nodeParent.Expanded = false; } TreeListNode nodeParentC2 = tree.FindNodeByKeyValue(UnitChildId.ToString()); if (nodeParentC2 != null) { nodeParentC2.Expanded = true; foreach (TreeListNode c in nodeParentC2.ChildNodes) { if (c.Expanded) { c.Expanded = false; } if (Convert.ToInt32(idEmp) == Convert.ToInt32(c.Key.Substring(1))) { c.Expanded = true; c.Focus(); } } } } } } tree.RefreshVirtualTree(); }
protected void treeList_CallBack(object sender, DevExpress.Web.ASPxTreeList.TreeListCustomCallbackEventArgs e) { ASPxTreeList tree = sender as ASPxTreeList; tree.RefreshVirtualTree(); }