Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (fvTrainType.CurrentMode == FormViewMode.Insert)
            {
                if (hfInsert.Value == "-1")
                {
                    ((HiddenField)fvTrainType.FindControl("hfParentId")).Value = Request.QueryString["id"];
                }
                else
                {
                    ((HiddenField)fvTrainType.FindControl("hfParentId")).Value = hfInsert.Value;
                }
            }

            string strDeleteID = Request.Form.Get("DeleteID");

            if (strDeleteID != "" && strDeleteID != null)
            {
                TrainTypeBLL objBll      = new TrainTypeBLL();
                string       strParentID = objBll.GetTrainTypeInfo(Convert.ToInt32(strDeleteID)).ParentID.ToString();
                int          code        = 0;
                objBll.DeleteTrainType(Convert.ToInt32(strDeleteID), ref code);

                if (code != 0)//code=2292
                {
                    SessionSet.PageMessage = "该培训类别已被引用,不能删除!";
                }
                else
                {
                    ClientScript.RegisterStartupScript(GetType(),
                                                       "jsSelectFirstNode",
                                                       @"window.parent.tvTrainTypeChangeCallBack.callback('-1','Delete','" + strParentID + @"','Rebuild');                       
                            if(window.parent.tvTrainType.get_nodes().get_length() > 0)
                            {
                                window.parent.tvTrainType.get_nodes().getNode(0).select();
                            }",
                                                       true);
                }
            }
        }