4
I have the following code in Model:
public enum Lista
{
[Display(Name = "Lista_regular", ResourceType = typeof(Mensagem))]
Regular = 0,
[Display(Name = "Lista_irregular", ResourceType = typeof(Mensagem))]
Irregular = 1
}
In the internationalization file (.resx) I have:
I copied this Helper from someone on the internet:
public static MvcHtmlString EnumDropDownListFor<TModel, TProperty, TEnum>(
this HtmlHelper<TModel> htmlHelper,
Expression<Func<TModel, TProperty>> expression,
TEnum selectedValue)
{
IEnumerable<TEnum> values = Enum.GetValues(typeof(TEnum))
.Cast<TEnum>();
IEnumerable<SelectListItem> items = from value in values
select new SelectListItem()
{
Text = value.ToString(),//Here
Value = value.ToString(),
Selected = (value.Equals(selectedValue))
};
return SelectExtensions.DropDownListFor(htmlHelper, expression, items);
}
Where the comment "Here" is where I need to put the value that is in the internationalization file. I have tried several other options and so far have not succeeded. How I do this?
Thanks Gypsy, went to try to implement and then I give you a return.
– Andrés Menéndez