/// <summary> /// 增加事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_Add_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { BtnName = BtnNam.Add; Tab_Common1.SelectedTabPage = Page_Preview; Tab_Common1.SelectedTabPage.PageEnabled = false; EnabledByBtnNam(BtnNam.Add); EDabDtControls(EDabType.Enable); View_Common1.OptionsBehavior.Editable = true; View_Common1.OptionsBehavior.ReadOnly = false; //删除所有数据 View_Common1.OptionsSelection.MultiSelect = true; View_Common1.SelectAll(); View_Common1.DeleteSelectedRows(); View_Common1.OptionsSelection.MultiSelect = false; List <ExpandoObject> EObj = AddNewRow(View_Common1); ((BindingList <ExpandoObject>)View_Common1.DataSource).Add(EObj[0]); View_Common1.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom; SetColumnEdit(View_Common1, "Panel3"); } catch (Exception Ex) { Common.ShowMsg(Ex.Message); } }
/// <summary> /// 取消事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_Cancel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { BtnName = BtnNam.Cancel; BtnEnabledByFocusRow(); Page_Detail.PageEnabled = true; EDabDtControls(EDabType.Disable); AssiValue(); Page_Preview.PageEnabled = true; View_Common1.DeleteSelectedRows(); View_Common1.CloseEditor(); View_Common1.OptionsBehavior.Editable = false; View_Common1.OptionsBehavior.ReadOnly = true; //重新刷新数据 ExpandoObject EObject = (ExpandoObject)View_Common2.GetFocusedRow(); ShowData(Grip_Common1, GetDataByFocRow(EObject, "Panel3"), GetDataByPKToChCol("Panel3"), View_Common1, "Panel3"); } catch (Exception Ex) { Common.ShowMsg(Ex.Message); } }