.net MVC accessing a radio button

Hi Everyone,

I am trying to access radio buttons from a for each loop in my controller, but I am not sure how to grab the selected answers and use them in my controller, can anyone help me out here? This is the code in my view

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
@using (Html.BeginForm("ProcessScore", "UserTest", new { Model }))
{

    foreach (var item in Model)
    {
        @item.question<br />
        
    <input id="Radio1" type="radio" name="@item.TestID" value="@item.choice1" /><br />
    <input id="Radio1" type="radio" name="@item.TestID" value="@item.choice2" /><br />
    <input id="Radio1" type="radio" name="@item.TestID" value="@item.choice3" /><br />
    <input id="Radio1" type="radio" name="@item.TestID" value="@item.choice4" /><br />
    }

        <input id="Submit1" type="submit" value="submit" name="finishTest"/>
}



How would I access the selected value of each generated radio group in my controller?

Edit: had to retype it
Last edited on
I solved it thanks anyway
Registered users can post here. Sign in or register to post.