I've got the following page trying to send back the data in the model. At the moment, I only want to return the model in an unmanipulated state just to see that I get back whatever I've sent out to the client.
@model List<UserSetting>
@using (Html.BeginForm("SaveSettings", "Account", Model, FormMethod.Post))
{
<table>
<tr>
<th>User name</th>
<th>Setting</th>
<th>Value</th>
<th>Order</th>
</tr>
@foreach (UserSetting setting in Model)
{
<tr>
<td>@setting.User.UserName</td>
<td>@setting.Name</td>
<td>@setting.Value</td>
<td>@setting.Order</td>
</tr>
}
</table>
<input type="submit" />
}
However, the object received in the controller is empty. It's not null, so it seems that I'm posting back something but for some reason, that something contains zero elements.
[HttpPost]
public void SaveSettings(List<UserSetting> settings) { ... }
What am I missing and how do I troubleshoot it? I have the sensation that it's something really easy and that I'll feel really stupid when someone points that out to me.