private void btnAdd() { try { int iFoc = gridView1.FocusedRowHandle; Frm代理商Edit frm = new Frm代理商Edit(); frm.dt地区 = (DataTable)ItemLookUpEdit地区.DataSource; frm.dt部门 = (DataTable)ItemLookUpEdit部门.DataSource; frm.ShowDialog(); if (frm.DialogResult == DialogResult.OK) { GetGrid(); gridView1.FocusedRowHandle = iFoc; } } catch (Exception ee) { throw new Exception("新增失败:" + ee.Message); } }
/// <summary> /// 修改 /// </summary> private void btnEdit() { //gridView1.OptionsBehavior.Editable = true; //sState = "edit"; gridView1.OptionsBehavior.Editable = false; int iFoc = gridView1.FocusedRowHandle; string sVenCode = gridView1.GetRowCellDisplayText(iFoc, gridColcVenCode).ToString().Trim(); Frm代理商Edit frm = new Frm代理商Edit(sVenCode); frm.dt地区 = (DataTable)ItemLookUpEdit地区.DataSource; frm.dt部门 = (DataTable)ItemLookUpEdit部门.DataSource; frm.ShowDialog(); btnRefresh(); //if (frm.DialogResult == DialogResult.OK) //{ // GetGrid(); // gridView1.FocusedRowHandle = iFoc; //} }