Localize DropDownList ListItem RRS feed

  • Question

  • User1269961235 posted

     Hi there,

     I've been working through the localization tutorials for .net 2.0 My problem is I can't seem to find out how the items of a DropDownList are Localized against a resx file. I've found one example that uses the following syntax in the Page_Load event:



     However, I thought you would be able to handle it the same way labels are, using the "meta:resourceKey". What's the best way to accomplish this?

    Thanks in advance for any help [:D]




    Thursday, July 26, 2007 6:13 AM


  • User-1506829456 posted


    Yes, sure, you can use meta:resourcekey to get text for the list items. Here is an example.

    <asp:DropDownList runat="server" ID="Language1" AutoPostBack="True" meta:resourcekey="DropDownList1Resource1">
    <asp:ListItem Value="auto" Text="Select Language" meta:resourcekey="ListItemResource7"/>
    <asp:ListItem Value="en" Text="English" meta:resourcekey="ListItemResource1" />
    <asp:ListItem Value="de-ch" Text="German" meta:resourcekey="ListItemResource2" />
    <asp:ListItem Value="ja" Text="Japanese" meta:resourcekey="ListItemResource3" />
    <asp:ListItem Value="ru" Text="Russian" meta:resourcekey="ListItemResource4" />
    <asp:ListItem Value="it" Text="Italian" meta:resourcekey="ListItemResource5" />
    <asp:ListItem Value="ar" Text="Arabic" meta:resourcekey="ListItemResource6" />

    The following 2 links are achieving the same thing as you do.



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 30, 2007 3:36 AM