ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Displaying Allowable Values as Radio Buttons

If the number of allowable values for a column is relatively small, consider a radio button presentation. At design time, go to the C1TrueDBGrid Designer, then to the Valueitems node for the column and set the Presentation property to PresentationEnum.RadioButton. Or, in code:

·      Visual Basic

Me.C1TrueDBGrid1.Columns("Country").ValueItems.Presentation = PresentationEnum.RadioButton

·      C#

this.c1TrueDBGrid1.Columns["Country"].ValueItems.Presentation = PresentationEnum.RadioButton;

·      Delphi

Self.C1TrueDBGrid1.Columns['Country'].ValueItems.Presentation := PresentationEnum.RadioButton;

If necessary, adjust the Width property of the column style and the RowHeight property of the grid to accommodate all of the items.

For a given cell, if the underlying data does not match any of the available values, none of the radio buttons will be selected for that cell. However, a default ValueItem object can be provided that will be selected instead.

In this example, the last ValueItem has an empty Value property, but the DisplayValue is set to Other. This means that when Country fields that do not match any of the items are displayed their value in the grid will be displayed as Other.

·      Visual Basic

Me.C1TrueDBGrid1.Columns("Country").ValueItems.DefaultItem = 5

·      C#

this.c1TrueDBGrid1.Columns["Country"].ValueItems.DefaultItem = 5;

·      Delphi

Self.C1TrueDBGrid1.Columns['Country'].ValueItems.DefaultItem := 5;

In this example, 5 is the zero-based index of the default item.


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.