Check only one checkbox in GridViewCheckBoxColumn
Product Version | Product | Author | Last modified |
---|---|---|---|
Q3 2009 SP1 | RadGridView for WinForms | Nikolay Diyanov | Jan 13, 2009 |
INTRODUCTION
By default, GridViewCheckBoxColumn allows for multiple checked checkboxes. However, in certain cases you may want to use it as a kind of RadioButton column - i.e. allow the user to check only one checkbox at a time.
SOLUTION
In order to implement the desired requirement, first subscribe to the ValueChanged event and then execute the following code snippet in the ValueChanged event handler:
Basically, we first check if the current editor is RadCheckBoxEditor and if the editor's value is true. If this case is true, we set the value of all the cells contained in the current column, but not contained in the current row to false.