导航

一行中只能选择一个列的值

Posted on 2012-09-25 20:52  毅无涯  阅读(190)  评论(0编辑  收藏  举报

private void repositoryItemCheckEdit1_CheckedChanged(object sender, EventArgs e)
     {
         CheckEdit edit = sender as CheckEdit;
         if (edit.Checked) {
             for (int i = 0; i < gridView1.Columns.Count; i++) {
                 if (gridView1.Columns[i].ColumnEdit != repositoryItemCheckEdit1
                     || gridView1.Columns[i] == gridView1.FocusedColumn)
                     continue;
                 gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[i], false);
             }
         }
     }

 

     private void repositoryItemCheckEdit1_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
     {
         if (e.NewValue != null && (bool)e.NewValue == false)
             e.Cancel = true;
     }

 

image