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

 

posted @ 2014-03-28 15:42  SharkLock  阅读(536)  评论(0编辑  收藏  举报