Daniel Sibaja
Daniel Sibaja

Reputation: 1367

How to extract selected value from DropDownListFor

I need help to extract what i select here :

<% var equipo = Html.DropDownListFor(model => model.campeonato.equipo, 
                 new SelectList(Model.campeonato.equipo, "idEquipo", "nombre", Model.campeonato.equipo.First().idEquipo), 
                 new { @required = "required", @class = "infofield" });%>

<%:Html.DropDownListFor(model => model.idJugadora, 
                  new SelectList(Model.campeonato.equipo.Where(d=>d.idEquipo.Equals(equipo)).ToList(), "idJugadora", "nombre", Model.campeonato.equipo.First().jugadora), 
                  new { @required = "required", @class = "infofield" })%> 

If i do it on that way, it doesn't appear the dropdownlist in the View :S

Upvotes: 0

Views: 82

Answers (1)

Cheung
Cheung

Reputation: 15552

your can access the value via the Model you post.

public ActionResult Edit(campeonato campeonato_model)
{
   //Console.Write(equipo_model.equipo);
}

Upvotes: 1

Related Questions