I want to remove equal names from my dropdownlist, but they are from different id's. I wanted to where I would have to deploy the code if it would be in the view, or in the controller somewhere else.
Andthat'swhatthedropdownlistlookslike
This is my view:
@Html.ValidationMessageFor(a => a.NomeProdutoId)
@Html.LabelFor(a => a.NomeProdutoId, "Escolher Produto:")
@Html.DropDownListFor(a => a.NomeProdutoId, new SelectList(ViewBag.Compra, "Id", "NomeProduto"))
This is the line of code that ViewBag.Compra
is pulling
public IList<Compra> Lista()
{
string hql = "select c from Compra c;";
IQuery query = session.CreateQuery(hql);
return query.List<Compra>();
}