private void setParentFormtxx(DbOpt.InFoDlg info_dlg) { if (info_dlg.dlgObj == null || info_dlg.dlgSqlMainWindow == null || info_dlg.dlgSqlMainWindow.Trim() == "") { return; //主窗口未传入的sql为空不操作 } DevExpress.XtraGrid.Views.Grid.GridView gridview = (DevExpress.XtraGrid.Views.Grid.GridView)info_dlg.dlgObj; DataTable dtParentTmp = (DataTable)gridview.GridControl.DataSource; DataRow datarow = null; if (info_dlg.dlgKind == DbOpt.OpenWindowKind.Open) { #region 找记录 dtParentTmp.PrimaryKey = new DataColumn[] { dtParentTmp.Columns["PATHWAY_ID"] }; datarow = dtParentTmp.Rows.Find(lbl_id.Text); if (datarow == null) { return; } else { info_dlg.dlgdtPosition = dtParentTmp.Rows.IndexOf(datarow); } #endregion } else { datarow = dtParentTmp.NewRow(); } if (datarow != null) { DataRow drCur = null; DataTable dtTmp = DbOpt.GetDataTable(info_dlg.dlgSqlMainWindow + " and PATHWAY_ID='" + info_dlg.pKey1 + "'"); if (dtTmp.Rows.Count > 0) { drCur = dtTmp.Rows[0]; } for (int i = 0; i < dtTmp.Columns.Count; i++) { datarow[i] = drCur[i]; } if (info_dlg.dlgKind != DbOpt.OpenWindowKind.Open) { dtParentTmp.Rows.Add(datarow); info_dlg.dlgdtPosition = dtParentTmp.Rows.IndexOf(datarow); //dtParentTmp.Rows.Count - 1; //this.BindingContext[dtParentTmp].Position = info_dlg.dlgdtPosition; } int rowhandle = gridview.GetRowHandle(info_dlg.dlgdtPosition); if (gridview.GetRowExpanded(rowhandle) == false) { gridview.ExpandAllGroups(); } gridview.FocusedRowHandle = rowhandle; } }
private void comboBoxEdit1_SelectedIndexChanged(object sender, EventArgs e) { DataTable dt = GetDataTable(this.cmbLayer.Text); this.gridControl1.DataSource = dt; gridView1.RefreshData(); //this.gridControl1.MainView = this.gridView1; gridView1.Columns["ErrorFeatureID"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Count; gridView1.Columns["ErrorFeatureID"].SummaryItem.DisplayFormat = "合计:{0}"; gridView1.ExpandAllGroups(); }
private void btnGridAyar_GruplamalariAc_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { _GridView.ExpandAllGroups(); }