I have a row of row of controls which are binded to model properties. I want to have a button which creates another row of such controls binded to same properties. Is there any way to achieve this.

Here is the code: Model:

public class OrderModel
{
    public string ProductName { get; set; }

    public string Price { get; set; }
    [DataType(DataType.Text)]
    public int Quantity { get; set; }

    public int TotalPrice { get; set; }

   public  List<ProductModel> productList { get; set; }

   public double SubTotalPrice { get; set; }

   public double TotalAmount { get; set; }

   public int ProductID { get; set; }
}

And here the row of controls:

<tr>
        <td>@Html.DropDownListFor(model => model.ProductName, new SelectList(Model.productList, "ProductID", "ProductName"), "Select")</td>
        <td>@Html.EditorFor(model => model.Price)</td>
        <td>@Html.EditorFor(model => model.Quantity)</td>
        <td>@Html.EditorFor(model => model.TotalPrice)</td>
                      <i class="ion-plus-round"
               style="font-size: 25px;
            color: #e67e22;
            margin-left:5px;
            ">
            </i>
        </td>

Related posts

Recent Viewed