Good Night!
I could follow in this same question here
Good Night!
I could follow in this same question here
You have not set ViewBag
to return from Partial . Of course there will be a zero reference error:
public ActionResult NovaLinhaDeTipoDeLixo()
{
ViewBag.Lixo = db.TiposDeLixo.ToList();
return PartialView("_LinhaTipoDeLixo", new PontoDeColetaTipoDeLixo { Id = Guid.NewGuid() });
}
Hello, change your code as follows:
@Html.ListBox("Id", new SelectList((List<SeuNamespace.Lixo>)ViewBag.Lixo))
I hope I have helped.