protected void GridDpt_RowCommand(object sender, GridCommandEventArgs e) { int deptID = GetSelectedDataKeyID(GridDpt); if (e.CommandName == "Delete") { if (TreeDpt.FindNode(deptID.ToString()).Nodes.Count > 0) { Alert.ShowInTop("请先删除该指标下子部门!"); return; } BLL.t_Index BLL = new Maticsoft.BLL.t_Index(); if (BLL.GetModel(deptID).FatherId == null) { Alert.ShowInTop("根目录无法删除!"); return; } bool isTrue = BLL.Delete(deptID); if (!isTrue) { Alert.ShowInTop("删除失败!"); return; } else { BindTree(); LoadData(); } } if (e.CommandName == "Edit") { Window1.Title = "指标管理"; string openUrl = String.Format("./IndexEdit.aspx?dptId={0}", HttpUtility.UrlEncode(deptID.ToString())); PageContext.RegisterStartupScript(Window1.GetSaveStateReference(deptID.ToString()) + Window1.GetShowReference(openUrl)); } }