XtraGrid中checkbox状态设置

 

  private void rilueCHECKED1_QueryCheckStateByValue(object sender, DevExpress.XtraEditors.Controls.QueryCheckStateByValueEventArgs e)

        {

            string val = "";

            if (e.Value != null)

            {

                val = e.Value.ToString();

            }

            else

            {

                val = "False";//默认为不选    

            }

            if (val == "False")

            {

                e.CheckState = CheckState.Unchecked;

            }

            else

            {

                e.CheckState = CheckState.Checked;

            }



            e.Handled = true;

        }



        private void rilueCHECKED1_QueryValueByCheckState(object sender, DevExpress.XtraEditors.Controls.QueryValueByCheckStateEventArgs e)

        {

            if (e.CheckState == CheckState.Checked)

            {

                gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "CHECKED1", true);

            }

            else

            {

                gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "CHECKED1", false);

            }

            dsBarcode.AcceptChanges();

        }

 

你可能感兴趣的:(checkbox)