private void BindRecords() { var connString = System.Configuration.ConfigurationManager.ConnectionStrings["CTMContext"].ToString(); var relateRecordCommandText = $@"EXEC [dbo].[sp_GetIDOperationRelateRecord] @OperateNo = '{OperateNo}'"; var dsRecords = SqlHelper.ExecuteDataset(connString, CommandType.Text, relateRecordCommandText); if (dsRecords == null || dsRecords.Tables.Count == 0) { return; } this.gridControl1.DataSource = dsRecords?.Tables?[0]; this._relatedRecordIds = _IDService.GetIDOperationRelatedRecordIds(OperateNo); if (this._relatedRecordIds.Any()) { for (int index = 0; index < dsRecords.Tables[0].Rows.Count; index++) { DataRow dr = dsRecords.Tables[0].Rows[index]; if (this._relatedRecordIds.Contains(int.Parse(dr["RecordId"].ToString()))) { this.gridView1.SelectRow(this.gridView1.GetRowHandle(index)); } } } }