Friends I'm doing a drop down list with Razor and I'm trying to get the drop values, but I only get the name that I put in place of their values someone could guide me or tell me where I am wrong?
[HttpPost]
public void GetBanco() {
string[] keys = Request.Form.AllKeys;
string banco = keys[0]; // aquí el valor de banco es dropList
// D: wtf?
AddBanco(banco);
//end method
}
<div class="col-md-4">
@using (Html.BeginForm("GetBanco", "Control", FormMethod.Post, new { enctype = "multipart/form-data" })) {
<label>Elija un banco:</label> @Html.DropDownList("dropList", new SelectList(new[] { "Bancomer", "Banamex", "Santander", "Banorte" }), new { required = "required" })
<input type="submit" value="cargar" /> }
</div>