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);
                }
            }



        }

 

posted @ 2012-11-21 17:16  brian_lee  阅读(1735)  评论(0编辑  收藏  举报