I have the following two radio buttons in my razor form which uses a ternary operator to either default to checked or not checked and is bound to my model. Also, I need the first radio button to be defaulted to checked.
<input type=”radio” name=”specify-activation” @(Model.Details.EffectiveImmediately ? “checked=’checked'” : “”) />
<input type=”radio” name=”specify-activation” @(Model.Details.EffectiveInAWeek ? “” : “checked=’checked'”) />
I am moving over to the use of Html Helpers instead and wanted to do something like the following
-The first problem is that I seem to have lost the ability to make the buttons mutally exclusive. I thought that adding in the name attribute would do it but didn’t. I know that Html.RadioButton is mutually exclusive but Im not sure I can use it with the syntax I’m using here.
-The second problem is that I have lost the functionality of the ternary operator which checks or unchecks a button. I though the following would work since it seems to be all over the web but its not working for me
neither did
or
Any help appreciate. Thanks much.