How to display the RadioButton properly in the grid cell in WinForms?
Display the radio button
When the RadioButton is assigned as a CellType in the grid cells without using other properties, the RadioButton is not displayed in those cells. As a result, an empty space is shown.
Solution:
To resolve this problem, use the ChoiceList property to set the values to the RadioButton that is displayed. The number of RadioButtons are displayed based on the number of values given in the collection.
C#
//Sets the column 1 celltype as RadioButton this.gridGroupingControl1.TableDescriptor.Columns[1].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.RadioButton; StringCollection collection = new StringCollection(); collection.AddRange(new string[] { "one", "two" }); //Sets the choice list to display the RadioButton this.gridGroupingControl1.TableDescriptor.Columns[1].Appearance.AnyRecordFieldCell.ChoiceList = collection;
VB
'Sets the column 1 celltype as RadioButton Me.gridGroupingControl1.TableDescriptor.Columns(1).Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.RadioButton Dim collection As New StringCollection() collection.AddRange(New String() { "one", "two" }) 'Sets the choice list to display the RadioButton Me.gridGroupingControl1.TableDescriptor.Columns(1).Appearance.AnyRecordFieldCell.ChoiceList = collection
After applying the properties, the grid is shown as follows.
GridControl and GridDataBoundGrid have the same procedures to display the RadioButtons in the grid cells.
Samples:
C#: RadioButtonC#
VB: RadioButtonVB
Conclusion
I hope you enjoyed learning about how to display the RadioButton properly in the grid cell in WinForms GridControl.
You can refer to our WPF SfDataGrid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF SfDataGrid example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!