Localization with one linkbutton

Last post 10-27-2008 10:09 AM by griff303. 3 replies.

Sort Posts:

  • Localization with one linkbutton

    10-20-2008, 3:27 PM
    • Contributor
      2,805 point Contributor
    • griff303
    • Member since 02-03-2004, 11:53 AM
    • Posts 735

    I have a client that doesn't care for the dropdownlist(of course) to switch the culture of the site. They want it to switch on one link(button) or link if works. I have tried, but it pretty much defaults back because of the page_load and all the examples I have seen have 2 link buttons on the page. Anyone have links or a good example of using a single link or linkbutton for the switching of the culture? It figures I had the dropdownlist working like a charm and now they want it switched.

     

     

    - km
    ______________________________________
    "always here and always forever"
  • Re: Localization with one linkbutton

    10-20-2008, 4:43 PM
    • All-Star
      24,858 point All-Star
    • budugu
    • Member since 01-12-2006, 2:15 PM
    • North Carolina
    • Posts 3,708

    check this code..

    protected override void InitializeCulture() 
    { 
        string culture = Session("myCulture"); 
        if (string.IsNullOrEmpty(culture)) { 
            culture = "en-US"; 
        } 
        System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture); 
        base.InitializeCulture(); 
        
    } 
    
    //In button click event, add this code..
        Session("myCulture") = "fr-CA"; 
        Server.Transfer(Request.Url.PathAndQuery, false); 
     
    Vijay Kodali || My Blog


    "Don't be afraid to be wrong; otherwise you'll never be right."
  • Re: Localization with one linkbutton

    10-21-2008, 6:59 PM
    • All-Star
      59,879 point All-Star
    • anas
    • Member since 09-21-2006, 8:31 AM
    • Palestinian Territory, Occupied
    • Posts 6,775
    • Moderator

     Griff ,

    I don't understand the problem , do you want to use a one linkbutton as langauge switcher ?

    Thanks

    Regards,

    Anas Ghanem | Blog

  • Re: Localization with one linkbutton

    10-27-2008, 10:09 AM
    • Contributor
      2,805 point Contributor
    • griff303
    • Member since 02-03-2004, 11:53 AM
    • Posts 735

    Yeah it was a single linkbutton and got it to work. Just have to do some checking on page_load event. It works pretty slick now.

    - km
    ______________________________________
    "always here and always forever"
Page 1 of 1 (4 items)