private void btnExportDetail_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (selection.SelectedCount == 0) { MessageBox.Show("请先选择需要导出明细的记录"); } else { string strDBDID = null; for (int i = 0; i < selection.SelectedCount; ++i) { int RowIndex = selection.GetSelectedRowIndex(i); int RowHandle = gridView1.GetRowHandle(RowIndex); string strTemp = gridView1.GetRowCellDisplayText(RowHandle, colDBDID); strDBDID += "[DBDID] = \'" + strTemp + "\' Or "; } int index = strDBDID.LastIndexOf("'"); strDBDID = strDBDID.Substring(0, index + 1).Trim(); FrmAllocateDetail FrmAD = new FrmAllocateDetail(strDBDID); FrmAD.btnExportGrid_ItemClick(sender, e); } }