This is a migrated thread and some comments may be shown as answers.

Displaying combobox instead of checkbox in boolean columns

3 Answers 126 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Gonzalo Contento
Top achievements
Rank 1
Gonzalo Contento asked on 15 Aug 2012, 08:31 PM
Is it possible to override the default behavior of RadGridView and display combobox with "Yes" and "No" instead of checkboxes for boolean columns?

3 Answers, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 16 Aug 2012, 03:16 PM
Hi Gonzalo,

 You can define GridViewComboBoxColumn to get the desired functionality. Please take a look at this article for more information. You can use its ItemsSource property in order to bind it to some DataBase object or some other type of collection. 

Please find attached a sample project that shows you how to achieve your goal.

All the best,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Gonzalo Contento
Top achievements
Rank 1
answered on 16 Aug 2012, 03:44 PM
Yoan,

Thank you for the email. However, in my scenario, I don't know the number/type of columns in advance - they are added dynamically when I set the grid's item source. 
Therefore the column ends up being a GridViewComboBoxColumn with a DataType of bool? (nullable boolean).
What approach can I use in that scenario?

Thanks.
0
Yoan
Telerik team
answered on 20 Aug 2012, 12:26 PM
Hi Gonzalo,

 You can subscribe to AutoGeneratingColumns event of the RadGridView and cancel the generating of the column that you do not need (the CheckBoxColumn). After that you can set the ComboBox column. You can also check this link. 

All the best,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Gonzalo Contento
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Gonzalo Contento
Top achievements
Rank 1
Share this question
or