Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul Sterling 719 posts 1556 karma points MVP 9x admin c-trib
    Oct 27, 2009 @ 20:08
    Paul Sterling
    0

    Localize a Drop Down List in User Control using Dictionary

    Any Umbraco wizards have a suggestion for localizing an <asp:DropDownList... control using the Umbraco Dictionary?

    I see this snippet is the pattern for file-based localization, but was looking for a more Umbraco'ish approach:

    protected override void OnPreRender(EventArgs e)
    {
        ResourceManager rm = ResourceManager.CreateFileBasedResourceManager("Country",
        Server.MapPath("~/Resources") + Path.DirectorySeparatorChar, null);

        ResourceSet rs = rm.GetResourceSet(CultureInfo.CurrentCulture, false, true);

        CountryList.DataSource = rs;
        CountryList.DataTextField = "Value";
        CountryList.DataValueField = "Key";
        CountryList.DataBind();
    }

    Thank you

Please Sign in or register to post replies

Write your reply to:

Draft