//protected void OnGridView_RowSelectChanged(Object sender, XSelectedRowChangedEventArgs e) //{ // if (null != Event_SelectChanged) // { // this.setFgSelfValue(); // this.Event_SelectChanged(sender, e); // } //} void xapFormControl_ModelFilled(object sender, EventArgs e) { if (this.emsordrug.Fg_self == true) { cr.Checked = true; gridView.Enabled = false; } else { cr.Checked = false; gridView.Enabled = true; warncard.Visible = false; //设置表格选中行 EmsOrDrug focusDrug = this.mms.FirstOrDefault(p => p.Id_mm == this.emsordrug.Id_mm); if (focusDrug != null) { XDataRow row = gridView.DataTable.GetRow(focusDrug); row.Selected = true; row.Focus(); } } this.xapFormControl.DataChanged -= new EventHandler <DataChangedEventArgs>(xapFormControl_DataChanged); this.xapFormControl.DataChanged += new EventHandler <DataChangedEventArgs>(xapFormControl_DataChanged); }
void xapFormControl_DataChanged(object sender, DataChangedEventArgs e) { if (e.PropName == "Fg_self") { //gridView.DataTable.SelectedRowChanged -= OnGridView_RowSelectChanged; if (e.Input != null && e.Input.Equals("true")) { warncard.Visible = true; List <XDataRow> selectRows = gridView.GetSelectedRows();//.DataTable.GetSelectedRows(); if (selectRows != null) { selectRows.ForEach(p => p.Selected = false); } gridView.Enabled = false; if (Event_SelectChanged != null) { this.setFgSelfValue(); XSelectedRowChangedEventArgs rowChanged = new XSelectedRowChangedEventArgs(); rowChanged.Data = SelectedDrug; Event_SelectChanged(gridView, rowChanged); } } else { warncard.Visible = false; gridView.Enabled = true; XDataRow row = gridView.DataTable.GetFirstRow(); if (row != null) { row.Selected = true; row.Focus(); if (Event_SelectChanged != null && SelectedDrug != null) { cr.Checked = false; this.setFgSelfValue(); XSelectedRowChangedEventArgs rowChanged = new XSelectedRowChangedEventArgs(); rowChanged.Data = SelectedDrug; Event_SelectChanged(gridView, rowChanged); } } } //gridView.DataTable.SelectedRowChanged += OnGridView_RowSelectChanged; } //this.xapFormControl.Refresh(); }