I have code similar to the structure below, the naming attributes have been designed in a way to deal with mvc model binding.
At the moment, with the code sampled below - I want 4 radio buttons - 2 for each students Forename and Surname. Where one radio button can be checked for each student e.g. student1 firstname and student2 surname.
At the moment - with my inability to adjust the name attribute of the input - all radio buttons are treated as the same group, as a result I can select a maximum of one radio button.
Any ideas, thanks.
public List<Student> Students = new List<Student>();
public class Student
{
public bool IsMale { get; set; }
public bool IsFemale { get; set; }
public bool IsOther { get; set; }
}
<div class="form-group-1">
<input type="radio" name="Students[0].IsMale" value="male"> Male
<input type="radio"name="Students[0].IsFemale"value="female">Female
<input type="radio" name="Students0].IsOther" value="other"> Other
</div>
<div class="form-group-2">
<input type="radio" name="Students[1].IsMale" value="male"> Male
<input type="radio"name="Students[1].IsFemale"value="female">Female
<input type="radio" name="Students[1].IsOther" value="other"> Other
</div>
<div class="form-group-3">
<input type="radio" name="Students[2].IsMale" value="male"> Male
<input type="radio"name="Students[2].IsFemale"value="female">Female
<input type="radio" name="Students[2].IsOther" value="other"> Other
</div>