Frage

I'm trying to add Bootstrap classes to a set of radio buttons.

@Html.RadioButtonFor(model => model.Male, !Model.Male) Female
@Html.RadioButtonFor(model => model.Male, Model.Male) Male

Just don't seem to get the right way of doing it. Any help appreciated. Thanks

War es hilfreich?

Lösung

@Html.RadioButtonFor(model => model.Male, !Model.Male, new { @class = "female"})
@Html.LabelFor(model => model.Male, "Female", new { @class = "female"})

@Html.RadioButtonFor(model => model.Male, Model.Male, new { @class = "male"})
@Html.LabelFor(model => model.Male, "Male", new { @class = "male"})
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top