Click here to Skip to main content
Rate this: bad
good
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;
        }
        base.InitializeCulture();
    }
}
 
What is the cause? Please Help.
Posted 20-Sep-12 22:32pm
Nuha IT654
Comments
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.
--SA

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



Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2014
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