Automatyczna zmiana wartości po wyborze

0

Cześć. Mam pytanie czy jest możliwość aby po wyborze z listy enumdropdownList od razu bez wcisnięcia potwierdzenia buttonem ?

@model IEnumerable<Sklep.Models.OrderItems>
@{
   ViewBag.Title = "ListYourProduct";
}

<h2>Lista Produktów zamówiona przez twoich klientów</h2>

<table class="table table-striped">
   <thead>
       <tr>
           <th>Nazwa</th>
           <th>Cena</th>
           <th>Ilość</th>
           <th>Imię</th>
           <th>Nazwisko</th>
           <th>Stan zamówienia</th>
           <th>Akacja</th>
       </tr>
   </thead>
   <tbody>
       @foreach (var item in Model)
       {
           <tr>
               <td>@item.Product.Name</td>
               <td>@item.Price</td>
               <td>@item.Quantity</td>
               <td>@item.Orders.FirstName</td>
               <td>@item.Orders.SecondName</td>
               <td>
                   @using (Html.BeginForm("ChangeOrderStatus", "Manage"))
                   {
                       @Html.HiddenFor(x => item.OrderItemsId)
                       @Html.EnumDropDownListFor(o => item.OrderStatus)
                   }
               </td>
               <td><a href="@Url.Action("OrderProductDetails", "Order", new { id = item.OrderItemsId })">Szczegóły</a></td>
           </tr>
       }
   </tbody>
</table>


       public OrderStatus ChangeOrderStatus(OrderItems order)
       {
           OrderItems newOrder = db.OrdersItems.Find(order.OrderItemsId);

           newOrder.OrderStatus = order.OrderStatus;
           db.SaveChanges();

           return order.OrderStatus;
       }
0

Dzięki, działa. A wiesz może, czemu ten formularz przesyła tylko stan zamówienia?

@using (Html.BeginForm("ChangeOrderStatus", "Order"))
  {
    @Html.HiddenFor(x => item.OrderItemsId)
    @Html.EnumDropDownListFor(x => item.OrderStatus,  new { onchange = "this.form.submit();" })
  }

1 użytkowników online, w tym zalogowanych: 0, gości: 1