I'm trying to implement a DropDownList
in a View
of mine that is for form, but I need the value selected to go to ViewBag
. This is my View
where there is " Selected Car ", it would need to transform my from Textbox
to DropDownList
:
Thisisthecodeformyview:
<divclass="form-group">
<label for="carro" class="col-sm-2 control-label">Carro selecionado</label>
<div class="col-sm-10">
<input type="number" class="form-control" id="carro" name="carro" required>
</div>
</div>
This is my Controller
:
public ActionResult FormData()
{
ViewBag.Veiculo = veiculoDAO.Lista();
return View();
}