Exemple #1
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsAdd_Click(object sender, EventArgs e)
        {
            frmDistrictDetail frm = new frmDistrictDetail();

            frm.OpType = "Add";//操作类型
            if (DialogResult.OK == frm.ShowDialog())
            {
                BindGridViewData();//重新绑定数据
            }
        }
Exemple #2
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsEdit_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection rows = this.dgDistrict.SelectedRows;

            if (rows.Count == 0)
            {
                return;
            }
            else
            {
                frmDistrictDetail frm = new frmDistrictDetail();
                frm.OpType = "Edit";                                                    //操作类型
                int id = Convert.ToInt16(rows[0].Cells["DistrictID"].Value.ToString()); //要编辑的主键
                frm.DistrictID = id;                                                    //主键值
                if (DialogResult.OK == frm.ShowDialog())
                {
                    BindGridViewData();//重新绑定数据
                }
            }
        }