following is my view code, I pass list from controller to view and here I am iterating that list through foreach I want to pass the same view-model list to the action when I submit the form
@model IEnumerable<AskQuestionViewModel>
.
.
.
<table class="table table-bordered">
<thead>
<tr>
<td>Question</td>
<td>Yes</td>
<td>No</td>
</tr>
</thead>
<tbody>
@foreach (var q in Model)
{
<tr>
<td>@q.Question</td>
@if (q.Answer == true)
{
<td><input type="radio" name="@q.QuestionID" value="true" checked />/td>
}
else
{
<td><input type="radio" [email protected] value="true" required /></td>
}
@if (q.Answer == false)
{
<td><input type="radio" [email protected] value="false" checked /></td>
}
else
{
<td><input type="radio" [email protected] value="false" required /></td>
}
</tr>
}
The following is action code
[HttpPost]
public ActionResult AskQuestions(List<AskQuestionViewModel> askQVM)
{
...
}
I'm getting null in askQVM