I have the following dropdownlist:
@Html.DropDownListFor(m => m.SelectedOrderCodeId, new SelectList(Model.OrderCodesList, "OrderCodeId", "DisplayString"))
Now the OrderCodesListhas the following: OrderCodeId,DisplayString & Percentage
How can I set a HiddenFor value to the Percentage of the value selected from that dropdownlist? (Below code has to be complete according to pseudo cause I'm not sure what to do next - if it is even possible).
@Html.HiddenFor(m => m.FinancialSupportPercentage, new { @Value = Model.OrderCodesList.Where
pseudo:
OrderCodesList.Select 'Percentage'
Where
'OrderCodeId'
is the `Selected 'OrderCodeId` from the `DropDownListFor`
Here is a simple way:
Class
Controller
View