culture value in javascript-VBForums
Results 1 to 4 of 4

Thread: culture value in javascript

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2008
    Posts
    2

    culture value in javascript

    hi i was wondering how i can get the pages culture value with javascript code. I can set the culture in the VB backend for the site just fine. But i don't know how to check the value of the culture being called ("en-CA / fr-fr") in my javascript. I am aiming to change my sites CSS script depending on the culture value but first i need to check what it is.

    OR i can do this on the page load in the backend via VB code, but in that section i don't know how to change the CSS for all the page.

    So for a answer i either need to know how to :

    -Check the culture Value in javascript
    OR
    -Change all the page's CSS in VB code

  2. #2
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: culture value in javascript

    Because you can detect the user's current culture in the codebehind, you can dynamically set the CSS file to use by creating an HtmlGeneric control, set the tag to "link", rel to "stylesheet" and href to the path of the CSS file based upon the culture that you have. Then, add that to the Page.Head of the page.

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2008
    Posts
    2

    Re: culture value in javascript

    ya thats the problem i'm having though i'm not sure how to check what culture it currentally is using so i can change the href link to the css sheet.

  4. #4
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: culture value in javascript

    Check either Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"] or Request.UserLanguages.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.