List binding demo
ListBinding/Index.cshtml
@using (Html.BeginForm())
{
<table class="tt">
@for (var j = 0; j < Model.Dinners.Count(); j++)
{
var i = j;
<tr>
<td>
@Html.HiddenFor(o => o.Dinners[i].Id)
@Html.Awe().TextBoxFor(o => o.Dinners[i].Name).Value(Model.Dinners[i].Name)
@Html.ValidationMessageFor(o => o.Dinners[i].Name)
<br />
</td>
<td>
@Html.Awe().DatePickerFor(o => o.Dinners[i].Date).Value(Model.Dinners[i].Date).ClearButton()<br />
@Html.ValidationMessageFor(o => o.Dinners[i].Date)
</td>
<td>
@Html.Awe().LookupFor(o => o.Dinners[i].ChefId).Controller("ChefLookup").Value(Model.Dinners[i].ChefId).ClearButton()<br />
@Html.ValidationMessageFor(o => o.Dinners[i].ChefId)
</td>
<td>
@Html.Awe().MultiLookupFor(o => o.Dinners[i].MealsIds).Controller("MealsMultiLookup").Value(Model.Dinners[i].MealsIds).ClearButton()<br />
@Html.ValidationMessageFor(o => o.Dinners[i].MealsIds)
</td>
</tr>
}
</table>
<br/>
@Html.AntiForgeryToken()
<input type="submit" value="submit" class="awe-btn"/>
}
Comments