I created the following helper:
public static HtmlString DropDownListEnum<TEnum>(this HtmlHelper htmlHelper, string name, int? valorSelecionado = null)
{
List<SelectListItem> lstEnum = AttributesHelper.ToSelectList<TEnum>(valorSelecionado);
MvcHtmlString html = htmlHelper.DropDownList(name, lstEnum, new object { });
return html;
}
And when trying to call it in View the TEnum was identified as an html tag.
@Html.DropDownListEnum<TipoObjetoEnum>("ddlTeste", Model.IdTipoObjetoFK)
How do I make html interpret TipoObjetoEnum
as a TEnum instead of a tag?