asp.net 2.0 master page

Last post 08-17-2005 4:47 PM by vimodi. 3 replies.

Sort Posts:

  • Stick out tongue [:P] asp.net 2.0 master page

    08-16-2005, 5:59 PM
    • Member
      225 point Member
    • stWooE
    • Member since 06-30-2004, 3:17 PM
    • Posts 45
    hello all
    can anyone tell me how to se up CultureInfo and UICulture from master page(System.Web.UI.MasterPage)?
    thank u for ur advice
    i hope it helps u :-)
    good luck
  • Re: asp.net 2.0 master page

    08-16-2005, 8:55 PM
    • Member
      605 point Member
    • vimodi
    • Member since 07-12-2002, 8:13 AM
    • Posts 117
    • AspNetTeam

    UICulture set in the content page will be applied to the Master page.

    Or

    It can be set in web.config
    <configuration>
       <
    system.web>
          <
    globalization culture="auto" uiCulture="auto" />
    </
    system.web>
    </
    configuration>


     

    Vishal
    ---------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: asp.net 2.0 master page

    08-17-2005, 5:06 AM
    • Member
      225 point Member
    • stWooE
    • Member since 06-30-2004, 3:17 PM
    • Posts 45

    thank u for reply

    ok i'll describe my situation

    i have one master page for all aspx pages in my project. this master page has a dropdownlist control(postback is enabled) where users can pick up allowed languages.
    so i want to set up CultureInfo and UICulture during tha application is running.

    in the Page u can override some methods like InitializeCulture() to set up CultureInfo and UICulture or in Page_PreInit(), but master page has no access to this methods.

    only the one way i know is to override the method

    void Application_AcquireRequestState(Object sender, EventArgs e)

    in global.acax class
    in .netframework 1.1 i could use Session to save user language, but framework 2.0 do not have access to Session.
    so i have to use Cookie or userprofile but it does not look user friendlyCrying [:'(]

    is any other possibilities to do that in master page?

    i hope it helps u :-)
    good luck
  • Re: asp.net 2.0 master page

    08-17-2005, 4:47 PM
    • Member
      605 point Member
    • vimodi
    • Member since 07-12-2002, 8:13 AM
    • Posts 117
    • AspNetTeam

    Here is one possible solution

    UiCulure need to set very early and it can be done by overriding the InitializeCulture() method of page class.
    But Master page can not overridde it .

    So problem will be solved if a Page base class is created and all the content pages will be inherited that base class. And in the base class you can set the UiCulture as follows.

    protected override void InitializeCulture()
    {
       UICulture = Request.Form[
    "ParentDropDown"] != null ? Request.Form["ParentDropDown"] : "auto";
       
    base.InitializeCulture();
    }

    I have Dropdownlist (ParentDropDown) in the page and it has autopostback="true" so in the above code i am reading its value and assigning it to UiCulture.

    HTH,
    Vishal

    Vishal
    ---------
    This posting is provided "AS IS" with no warranties, and confers no rights.
Page 1 of 1 (4 items)