private void btnAdd_Click(object sender, EventArgs e) { if (CurrentNode == null) { MessageBox.Show("请选择菜单!"); return; } ModuleManageEditForm frm = new ModuleManageEditForm(); frm.FormMode = ModuleManageEditForm.EditType.Add; frm.DataSource = new Base_Module(); frm.ParentName = CurrentNode.Text; frm.ParentID = long.Parse(CurrentNode.Name); frm.DataBind(); frm.AfterUpdateHandler += frm_Closed; frm.Dock = DockStyle.Fill; frm.ShowDialog(); }
private void btnedit_Click(object sender, EventArgs e) { if (gv_module.SelectedRows.Count > 0) { var list = (List <Base_Module>)gv_module.DataSource; ModuleManageEditForm frm = new ModuleManageEditForm(); frm.FormMode = ModuleManageEditForm.EditType.Edit; frm.DataSource = list[gv_module.SelectedRows[0].Index]; frm.ParentID = list[gv_module.SelectedRows[0].Index].ParentId.Value; frm.ParentName = CurrentNode.Text; frm.DataBind(); frm.AfterUpdateHandler += frm_Closed; frm.ShowDialog(); } else { MessageBox.Show("请选择一条记录!"); } }