/// <summary> /// 添加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsAdd_Click(object sender, EventArgs e) { frmPageSizeDetail frm = new frmPageSizeDetail(null); frm.Text = "新增"; if (DialogResult.OK == frm.ShowDialog()) { BindGridViewData(false);//重新绑定数据 } }
/// <summary> /// 编辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsEdit_Click(object sender, EventArgs e) { DataGridViewSelectedRowCollection rows = this.dgPageSize.SelectedRows; if (rows.Count == 0) { TXMessageBoxExtensions.Info("至少要选择一行记录才能够操作!"); return; } else { int id = Convert.ToInt16(rows[0].Cells["PID"].Value.ToString());//要编辑的主键 frmPageSizeDetail frm = new frmPageSizeDetail(id); frm.Text = "修改"; if (DialogResult.OK == frm.ShowDialog()) { BindGridViewData(false);//重新绑定数据 } } }