[HttpGet] ActionResult Edit
Model model = dbContext.Table.Find(id);
ViewBag.MyID = new SelectList(dbContext.Table, "id", "value", model.value);
View Edit
@Html.DropDownList("MyID", (IEnumerable<SelectListItem>)ViewBag.MyID)
[HttpPost] ActionResult Edit
public ActionResul Edit(..., string MyID)
My Model
[Table("tb_estados_uf")]
public class Estado
{
[Key]
public int uf_id { get; set; }
[Display(Name = "Estado")]
public string uf_estado { get; set; }
[Display(Name = "UF")]
public string uf_sigla { get; set; }
public IEnumerable<Estado> ufIE { get; set; }
}
This is the top of my view:
@model Oficial.Models.Candidato
My Controller
public ActionResult Edit([Bind(Include ="(Candidato's Columns)..., uf_id (FK)")] Candidato objCandidato, FormCollection fc, HttpPostedFileBase file, string MyID)
The problem is this parameter, he's always 1
even when its recorded with the last record of my database.
Have anything that am i forget?
sorry with my english