2
I wanted to pass the text of the dropdown to the controller(Post) instead of the id, I don’t know how I can do this.
Controller:
ViewBag.AnoCatequeseID = new SelectList(db.AnoCatequese, "AnoCatequeseID", "Ano");
View:
@Html.DropDownListFor(model => model.grupo.AnoCatequese, (SelectList)ViewBag.AnoCatequeseID, "--Escolha um ano de Catequese--", htmlAttributes: new { @class = "form-control" })
I do not understand what the argument within the '(Ienumerable<???>)', is giving error.
– Simão Lopes
Appendage
@using SeuSistema.Modelsat the top of View.– Leonel Sanches da Silva
Anocatechesis is an auxiliary class without any kind of link in my template, and it will fill a string type field in my group template. where I’m using a Viewmodel.
@model WebAppCatechesis2.ViewModels.GrupoViewModel. You keep saying I don’t have any references on Ienumerable– Simão Lopes
db.AnoCatequesereturn which Model?– Leonel Sanches da Silva
model
AnoCatequese.– Simão Lopes
So that’s just it.
AnoCatequeseis not an auxiliary class.– Leonel Sanches da Silva
It’s an auxiliary table I have no connection to it.
– Simão Lopes