Click here to Skip to main content
11,644,286 members (67,914 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: Masterpage
I'm trying to develop a MultiLanguage web site using ASP.NET with C# My problem is: I want to make my MasterPage support switching among languages, but when i put the "InitializeCulture()" inside the masterpage.cs, I got this error.

this is my code:

public partial class BasicMasterPage : System.Web.UI.MasterPage
protected void Page_Load(object sender, EventArgs e)
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
    if (e.Day.IsToday)
        e.Cell.Style.Add("background-color", "#3556bf");
        e.Cell.Style.Add("font-weight", "bold");
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;

How can I create a Base class?
Posted 4-Aug-12 13:18pm
Nuha IT654

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The error means what it says. What makes you believe this method exists on the base class ? The compiler is telling you it does not. I checked the documentation, the compiler is right. This is not how you do locale in a web page.

I found this[^] with google. I think your core idea is OK, but the method you invented is not.
Nuha IT at 12-Sep-12 16:16pm
I have made a base class and worked perfectly without causing any errors.
But the working of the calendar has stopped; whenever I select a type of calendar from comboBox it just never appear it. why?

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

  Print Answers RSS
0 OriginalGriff 610
1 484
2 Afzaal Ahmad Zeeshan 453
3 Sergey Alexandrovich Kryukov 369
4 CPallini 352
0 OriginalGriff 925
1 DamithSL 636
2 Afzaal Ahmad Zeeshan 622
3 Sergey Alexandrovich Kryukov 548
4 CPallini 521

Advertise | Privacy | Mobile
Web02 | 2.8.150731.1 | Last Updated 12 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