How to get the selected value in dropdownlist
?
I need to get the selected value and pass this value to a session
.
I did with textbox
that way and it worked, but with dropdownlist
does not take the value.
I've done the following:
View
@Html.DisplayNameFor(model => model.IRPJ) :
@Html.DropDownListFor(model => model.IRPJ, new SelectList(new List<Object>
{
new { value = 0, text = "1,5"},
new { value = 1, text = "4,8"}
}, "value", "text", 0))
Controller
[HttpPost]
public ActionResult Detalhes(FormCollection frm)
{
object irpj = frm[1].ToString().Replace(".",",");
Session["IRPJ"] = irpj;
return RedirectToAction("ImprimirBoleto", new
{
irpj = Session["IRPJ"].ToString(),
});