Multiple Radio button groups in asp.net mvc3
I have developed a form in asp.net mvc3 which has multiple options to choose from. Please see the below image for clear picture. There are two groups "Accommodation" and "Pick up and drop" and these groups have multiple options to choose from. User should select only one option from each group but here I can select only one option from entire options i.e. I'm not able to choose both "Single sharing" and "Pick up and drop". Is there any way I can distinguish between two radio button groups?
foreach (var facilityType in facilityTypeGroup.ProductPriceDisplayFacility)
{
开发者_运维问答 <tr>
<td>
@Html.RadioButtonFor(m => m.SelectedChoice, @facilityType.FacilityTypeId + "_" + @facilityType.Price)
@facilityType.FacilityTypeName </td>
</tr>
}
To make them behave as a group, checkboxes in the same group must have the same name attribute. Then it's easy to either use the ModelBinder
or the Request
object to get the selected value.
精彩评论