RadioButtonFor

RadioButtonFor is a button control that can be selected, but not cleared, by an end-user. While paired with other radio buttons, RadioButtonFor enables end-users to select a single option from a group of choices.

Implementation Details

RadioButtonFor is realized by the RadioButtonExtension class. Its instance can be accessed via the ExtensionsFactory<ModelType>.RadioButtonFor<ValueType> helper method, which is used to add a RadioButtonFor 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 RadioButtonFor settings implemented by the RadioButtonSettings class, allowing you to fully customize the extension.

RadioButtonFor's client counterpart is represented by the ASPxClientRadioButton object.

Declaration

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

View code (Razor):

@Html.DevExpress().RadioButtonFor(model => model.IsActive,
    settings => {
        settings.Properties.AllowGrayed = true;
    }).GetHtml()

The code result is demonstrated in the image below.

MVC_RadioButtonFor_Declaration

See Also