DataRow dr = this.gridView1.GetDataRow(this.gridView1.FocusedRowHandle);//獲取選中行 string str = gridView1.GetFocusedRowCellValue("PEBID").ToString();//獲取某一行的指定列的值
獲取每行指定列的資料(可處理批量選擇)
List<int> selectRows; List<int> custcode = new List<int>(); selectRows = this.gridView1.GetSelectedRows().ToList(); foreach (int i in selectRows) { custcode.Add(int.Parse(this.gridView1.GetDataRow(i)["PEBID"].ToString())); }