I am currently using Html.BeginForm("test", testForm", FormMethod.Post)
in order to update the values from my existing page.
I have more than 2 for-loops which allow to display the column name and the corresponding column value:
@for (var ctr = 1; ctr <= 5; ctr++)
{
<tr>
@Html.HiddenFor(m => m[ctr].id)
@Html.HiddenFor(m => m[ctr].name)
<td>@Model[ctr].name</td>
<td>@Html.TextBoxFor(m => m[ctr].value, new { @class = "span6" })</td>
</tr>
}
and
@for (var ctr = 7; ctr <= 10; ctr++)
{
<tr>
@Html.HiddenFor(m => m[ctr].id)
@Html.HiddenFor(m => m[ctr].name)
<td>@Model[ctr].name</td>
<td>@Html.TextBoxFor(m => m[ctr].value, new { @class = "span6" })</td>
</tr>
}
I also have a 'fixed' line item, both with column name and its value:
<tr>
@Html.HiddenFor(m => m[11].id)
@Html.HiddenFor(m => m[11].name)
<td>@Model[11].name</td>
<td>@Html.TextBoxFor(m => m[11].value, new { @class = "span6" })</td>
</tr>
When I clicked the submit button, only the 'fixed' line item was being updated. The line items with inside the for-loops were not updating.
Any suggestions how to fix these?