Click here to Skip to main content
12,997,038 members (128,987 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 IT663
Sergey Alexandrovich Kryukov 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2017
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