Reputation: 543
I am using mvc.I am unable to get radio button value in controller.
@Html.RadioButtonFor(model => model.SelecetdOption, m.Name, new {});
Upvotes: 0
Views: 5754
Reputation: 981
You can have something like this in your view:
<input type="radio" id="rbOption1" name="rbMyChoices" value="Option1" />
<input type="radio" id="rbOption2" name="rbMyChoices" value="Option2" />
and then in your controller...
public actionresult MyAction(string rbMyChoices){
if(rbDents == "Option1")...
if(rbDents == "Option2")...
}
If you add rbMyChoices to your controller parameters, it will contain the selected Value of the rbMyChoices rbgroup.
Upvotes: 1