0
Good evening ,I am trying popular radio button varis as the value contained in my database ,however I am not able to do.
Here’s the view with the radiobutton
@model GuialetoLMS.Models.GuialetoModel
@foreach (var choice in Model.Vestibular)
{
@Html.RadioButton("answer", @choice.idVestibular ) @choice.NomeVestibular
}
And my controller
public ActionResult PaginaQuestao()
{
return View(db.Vestibular.ToList());
}
What is the error, what is happening?
– Leandro Angelo
The model item passed into the Dictionary is of type 'System.Collections.Generic.List`1[Guialetolms.Models.Vestibular]', but this Dictionary requires a model item of type 'Guialetolms.Models.Guialetomodel'.
– Robson Oliveira
The guy you’re passing to the view is wrong
db.Vestibular.ToList()
is returning aGuialetoLMS.Models.Vestibular
and not a@model GuialetoLMS.Models.GuialetoModel
.– user8545