0

、、を使用しWIndows 8Visual Studio 2012 Metroいます。を追加しDropDownListて、ユーザーに言語を選択させる必要があります。ユーザーが特定の言語を選択すると、ラベル内のすべてのテキスト値をその特定の言語に変更する必要があります。

私はこのチュートリアルに従いました

I  R-CLick project added `APPGlobal_Resource` folder
I R-Clicked and added `APPGlobal_Resource` and created a Resource file called rss.resx 
Then i duplicated this file and named it rss.fr.resx
I gave 2 values `String1` and `Hello` and `Bonjour` as values (in both files)
R-Click `dropdownlist` and `edit item`, and `ADD` and then gave `en-US` as `Name` and `value`as  `en-US` (same way i gave `en-fr`)
Then i set the Label property, `Data (Expression)` `Bindable property` to `Text` and `Expression Type` to `Resources`.

I gave the `Class Key` to `Res` and `Resource Key` to `String1`.

そして私は次のコードを書いたDefault.aspx.cs

 protected override void InitializeCulture()
        {
            base.InitializeCulture();
            String cult = Request["DropDownList1"];

            if (cult != null)
            {
                Culture = cult;
                UICulture = cult;
            }
        }

ドロップダウンはで表示されますen-US and en-frが、選択しても何も変わりません。どうすればこれを解決できますか?

4

1 に答える 1

1

わかりませんが、次のことが役立ちます。

System.Threading.Thread.CurrentThread.CurrentCulture = 
    new System.Globalization.CultureInfo( cult );
于 2013-01-17T19:44:19.800 に答える