Skip to main content

RadioButtonListFor

RadioButtonListFor represents a group of radio button editors that allow you to select one option from several.

Implementation Details

RadioButtonListFor is realized by the RadioButtonListExtension class. Its instance can be accessed via the ExtensionsFactory<ModelType>.RadioButtonListFor<ValueType> helper method, which is used to add a RadioButtonListFor extension to a view. This first method’s parameter is an expression that identifies model property to display and edit. The second method’s parameter provides access to the RadioButtonListFor‘s settings implemented by the RadioButtonListSettings class, allowing you to fully customize the extension.

The RadioButtonListFor‘s client counterpart is represented by the ASPxClientRadioButtonList object.

Declaration

RadioButtonListFor can be added to a view in the following manner.

@Html.DevExpress().RadioButtonListFor(model => model.PerformCheck,
    settings => {
        settings.Properties.Items.Add("Yes, this time only");
        settings.Properties.Items.Add("No, not this time");
        settings.Properties.Items.Add("Yes, always");
        settings.Properties.Items.Add("No, never");

        settings.SelectedIndex = 1;
    }).GetHtml()

The code result is demonstrated in the image below.

radiobuttonlist-declaration.png

See Also