Моя страница не изменит язык кто-то может взглянуть на мой код и скажите мне, что я делаю неправильно, это всегда идет на языке по умолчаниюстраницы не изменится язык
public partial class ChangeLanguage : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
SortedDictionary<string, string> objDic = new SortedDictionary<string, string>();
foreach (CultureInfo ObjectCultureInfo in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
{
RegionInfo objRegionInfo = new RegionInfo(ObjectCultureInfo.Name);
if (!objDic.ContainsKey(objRegionInfo.EnglishName))
{
objDic.Add(objRegionInfo.EnglishName, ObjectCultureInfo.Name);
}
}
foreach (KeyValuePair<string, string> val in objDic)
{
ddlCountries.Items.Add(new ListItem(val.Key, val.Value));
}
ddlCountries.SelectedValue = (HttpContext.Current.Profile as ProfileCommon).Preferences.Culture;
}
protected void btnChangeLanguage_Click(object sender, EventArgs e)
{
ProfileCommon profile = HttpContext.Current.Profile as ProfileCommon;
profile.Preferences.Culture = ddlCountries.SelectedValue;
}
}
protected override void InitializeCulture()
{
string culture = (HttpContext.Current.Profile as ProfileCommon).Preferences.Culture;
this.Culture = culture;
this.UICulture = culture;
}
Profile:
<properties>
<add name="FirstName" type="String"/>
<add name="LastName" type="String"/>
<add name="Gender" type="String"/>
<add name="BirthDate" type="DateTime"/>
<add name="Occupation" type="String"/>
<add name="WebSite" type="String"/>
<group name="Preferences">
<add name="Culture" type="String" defaultValue="en-NZ" allowAnonymous="true"/>
</group>
</properties>
ли вниз показать обновленный язык, который был выбран падение? – spinon
Нет возврата к значению по умолчанию в свойстве Culture в настройках профиля – ONYX