1
I’m trying to implement a DropDownList
in a View
mine that serves for form, but I need the selected value to go to a ViewBag
. This is my View
there where it is "Car Selected", I would need to turn my Textbox
in a DropDownList
:
That’s the code of my view:
<div class="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();
}
The field, is to put the bank ID and the description the column I want you to bring me?
– Guilherme Padovam
@That’s the name of the two fields of your table!!! fieldId would be the name of the key, and fieldDescription the name of the description that will appear in the box! That is, your List returns which fields to be placed as key and description!
– novic