Marius Vasile

Marius Vasile

  • 592
  • 1.9k
  • 145.3k

asp.net core Razor pages @Html.DropDownListFor selected value as Input

Nov 23 2020 10:48 PM
How do I use the selected value from @Html.DropDownListFor for OnPost input value?
 
  1. @Html.DropDownListFor(x => Model.HazardsListEdit.SelectedHazClassId,  
  2.             new SelectList(Model.HazardsListEdit.HazardsClasses, "Value""Text"),  
  3.             htmlAttributes: new { @class = "form-control", id = "HazClass", @required = true })  
 
  1. <input hidden asp-for="HazId.HazClass" value=" " />  
 

Answers (8)