dev gridcontrol checkbox
private void simpleButton1_Click(object sender, EventArgs e) { string strConn = "Data Source=xxx; User ID=xfx; Password=sd"; OracleConnection oconn = new OracleConnection(strConn); string strComm = "select * from ESSTICKETTYPE"; OracleDataAdapter oda = new OracleDataAdapter(strComm, oconn); DataSet ds = new DataSet(); try { oda.Fill(ds, "cx"); ds.Tables["cx"].Columns.Add("check", System.Type.GetType("System.Boolean")); gridControl1.DataSource = ds.Tables["cx"]; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { oconn.Close(); } }
private void simpleButton2_Click(object sender, EventArgs e) { if (this.simpleButton2.Text=="全选") { this.simpleButton2.Text = "全选取消"; for (int i = 0; i < gridView1.RowCount; i++) { gridView1.SetRowCellValue(i, "check", true); } } else { this.simpleButton2.Text = "全选"; for (int i = 0; i < gridView1.RowCount; i++) { gridView1.SetRowCellValue(i, "check", false); } } }