Click here to Skip to main content
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 22: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 OriginalGriff 645
1 Maciej Los 225
2 Abhinav S 171
3 Richard Deeming 160
4 Suvendu Shekhar Giri 159
0 Sergey Alexandrovich Kryukov 9,623
1 OriginalGriff 9,135
2 Peter Leow 5,042
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 2,581

Advertise | Privacy | Mobile
Web04 | 2.8.150327.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