Click here to Skip to main content
11,802,636 members (71,191 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: globalization
I had a problem with calendar in MasterPage so that's why I have used BaseClass, the problem was solved but the calendar stopped working.

My calendar has a listBox for choosing different georgian calendars, but whenevr I choose I doesn't work out.

This is my code for Base Class

public class BasePage : System.Web.UI.Page
    Dictionary<string, System.Globalization.Calendar> Calendars =
        new Dictionary<string, System.Globalization.Calendar>()
            {"GregorianCalendar", new GregorianCalendar()},
            {"HebrewCalendar", new HebrewCalendar()},
            {"HijriCalendar", new HijriCalendar()},
            {"JapaneseCalendar", new JapaneseCalendar()},
            {"JulianCalendar", new JulianCalendar()},
            {"KoreanCalendar", new KoreanCalendar()},
            {"TaiwanCalendar", new TaiwanCalendar()},
            {"ThaiBuddhistCalendar", new ThaiBuddhistCalendar ()}
    protected override void InitializeCulture()
        if (Request.Form["LocaleChoice"] != null)
            string selected = Request.Form["LocaleChoice"];
            string[] calendarSetting = selected.Split('|');
            string selectedLanguage = calendarSetting[0];
            CultureInfo culture = CultureInfo.CreateSpecificCulture(selectedLanguage);
            if (calendarSetting.Length > 1)
                string selectedCalendar = calendarSetting[1];
                var cal = culture.Calendar;
                if (Calendars.TryGetValue(selectedCalendar, out cal))
                    culture.DateTimeFormat.Calendar = cal;
            Thread.CurrentThread.CurrentCulture = culture;
            Thread.CurrentThread.CurrentUICulture = culture;

What is the cause? Please Help.
Posted 20-Sep-12 21:32pm
Nuha IT654
Sergey Alexandrovich Kryukov at 21-Sep-12 12:23pm
Tag it properly: C#, ASP.NET (isn't it?)...
"Stopped working" is not informative. I guess you need to use "Improve question" above.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 KrunalRohit 366
1 OriginalGriff 365
2 F-ES Sitecore 295
3 Afzaal Ahmad Zeeshan 230
4 CPallini 230
0 OriginalGriff 2,950
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,695
4 Richard MacCutchan 1,157

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100