|
public class Customer
{
public static List<Customer> order1 = new List<Customer>();
public Customer()
{
}
public int? CustomerId { get; set; }
public string Name { get; set; }
} |
|
<div class="form-row">
<div class="form-group col-md-6">
<div class="e-float-input e-control-wrapper">
@Html.TextBox("Customer___CustomerId", Model.Customer.CustomerId)
<span class="e-float-line"></span>
@Html.Label("Customer___CustomerId", "Customer CustomerId", new { @class = "e-float-text e-label-top" })
</div>
</div>
<div class="form-group col-md-6">
<div class="e-float-input e-control-wrapper">
@Html.TextBox("Customer___Name", Model.Customer.Name)
<span class="e-float-line"></span>
@Html.Label("Customer___Name", "Customer Name", new { @class = "e-float-text e-label-top" })
</div>
</div>
</div> |
|
<div class="form-row">
// A forEach is executed to render controls based on the list data items
@foreach (var x in Model.Customer)
{
<div class="form-group col-md-6">
<div class="e-float-input e-control-wrapper">
// Proper naming based on complex data index values is provided here in order to properly retrieve the value on save
@Html.TextBox("Customer___" + @Model.Customer.IndexOf(x) + "___CustomerId", @x.CustomerId)
<span class="e-float-line"></span>
@Html.Label("Customer___" + @Model.Customer.IndexOf(x) + "___CustomerId", "Customer ID " + @Model.Customer.IndexOf(x), new { @class = "e-float-text e-label-top" })
</div>
</div>
}
</div> |