Q: Is there a way to dynamically populate a drop down list with values from a resource file? So I have this .resx file and I want its values shown in a drop down list in ASP.NET MVC (C#).
Is this possible? Google couldn't help me, so I hope SO can :-)

A: This works for me
Html.DropDownList("ResxDropDownList",
    new SelectList(
        Resources.YourResource.ResourceManager.GetResourceSet(
            System.Globalization.CultureInfo.CurrentCulture,
            true,
            true
        ),
        "Key",
        "Value"
    )
)


A: It really depends on how you have the values saved in the RESX.
Let's just say you have the values saved as a string.
App_GlobalResources/Messages.resx:

Name   |   Value
---------------------
title  |   Mr.,Mrs.,Ms.

List<SelectListItem> items = new List<SelectListItem>();
foreach (string s in Resources.Messages.title.Split(new char[] { ',' }))
{
   items.Add(new SelectListItem() { Text = s, Value = s });
}
Response.Write(Html.DropDownList("Title", items));

