0
I have a ViewData
with my production orders. I’m making a app
where an operator can create a new production from the selected production order, but the ideal was that he did not need to automatically select and display the last production order ID.
I’m working with ASP-NET C# razor pages
.
This is my Viewdata in the controller:
ViewData["production_order_ID"] = new SelectList(_context.Production_Order, "production_order_ID", "production_order_ID");
This is my page:
<div class="col-md-2" style="margin-top:10px">
<label asp-for="Production.production_order_ID" class="control-label">Ordem de Produção:</label>
<select id="orderList" name="ids" asp-for="Production.production_order_ID" class="form-control" asp-items="ViewBag.production_order_ID" onchange="getSensors(); myFunction(event);"></select>
</div>
Now it’s showing the first Viewdata ID but what I wanted was to show the last one by default.
Thank you very much for the answer. Yes this would work, but I already solved my problem but I really appreciate the help and anyway.
– Guilherme Palumbo