所以我现在的问题是,当我提交以下表格时,我无法将我的模型放入我的控制器中.我试图让BillingCodes(这是一个BillingCodeObjects列表)中的项循环并显示.我已经删除了一些与这种情况无关的代码,使其更简单,更容易阅读.
这是我的观点的代码......
@using (Html.BeginForm("SubmitTimesheet", "Timesheet", FormMethod.Post))
{
foreach (var item in Model.BillingCodes)
{
<div class="button-padding">
<a class="btn btn-large btn-danger btn-block billCodeBtn">
<div class="btnText">@item.Name</div>
<div class="btnTime">@item.TotalHours</div>
<i class="icon-chevron-down billCodeIconUp billCodeIcon"></i>
<i class="hidden icon-chevron-up billCodeIconDown billCodeIcon"></i>
</a>
<div class="content" >
<div class="row timeEntry">
<p></p>
<div class="col-12 col-lg-2">
Enter Time:
<div class="row">
<div class="col-12">
@Html.DropDownListFor(model => item.EnterTimeHours, new SelectList(new[] {
new { Value = "0", Text = "0" },
new { Value = "1", Text = "1" },
new { Value = "2", …Run Code Online (Sandbox Code Playgroud)