I have an @Html.DropDownList that I filled with a List List with data already defined, the dropdown list is inside a form that is sent to the SaveConfiguration controller, I retrieve the data as a parameter to the FormCollection form controller but I could not retrieve the value that was selected (text of the selected option) in the controller, if I do it in the form var ValueDos = form ["source"] ;, I get the index that the dropdownlist gives to each option of the ddl
<div class="text-left col-md-4">
<label class="col-sm-12 control-label" for="email-03">Tipo de fuente:</label>
@Html.DropDownList("fuente", ViewBag.TiposFuente as SelectList, new { @class = "form-control", id = "TipoFuente", name = "TipoFuente" })
<br />
</div>
action result
[HttpPost]
public ActionResult GuardarConfiguracion(FormCollection form)
{
List<clsTipoFuente> LstTiposFuente;
LstTiposFuente = new List<clsTipoFuente>();
clsTipoFuente TipoFuenteArial = new clsTipoFuente()
{
IdTipoFuente = 1,
TipoFuente = "Arial",
};
LstTiposFuente.Add(TipoFuenteArial);
clsTipoFuente TipoFuenteCalibri = new clsTipoFuente()
{
IdTipoFuente = 3,
TipoFuente = "Calibri",
};
LstTiposFuente.Add(TipoFuenteCalibri);
clsTipoFuente TipoFuenteTimes = new clsTipoFuente()
{
IdTipoFuente = 5,
TipoFuente = "Times",
};
LstTiposFuente.Add(TipoFuenteTimes);
ViewBag.TiposFuente = new SelectList(LstTiposFuente, "IdTipoFuente", "TipoFuente");
var ValorUno = form["txtNombreLicitacion"];
var ValorDos = form["fuente"];
return View("Index");
}