Articles in this section
Category / Section

How to display the RadioButton properly in the grid cell in WinForms GridControl?

2 mins read

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.

Show the grid cell without radio button

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.

Show the grid cell with radio button

 

Note:

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 forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied