Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1037337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:50:27+00:00 2026-05-16T14:50:27+00:00

I am trying out some globalization in an asp.net mvc2 application but can’t get

  • 0

I am trying out some globalization in an asp.net mvc2 application but can’t get it to work fully. I am using the library http://github.com/nje/jquery-glob as a tool to display currency and dates etc according to user wishes. However something is bothering me a little. IU can’t get the client / server side validation to actually accept the globalization using jQuery. No matter what I try if I post back 40.00 everything works ok but if I post 40,00 it is accepted as 0 (not a valid .NET invariant decimal value). I tried to follow @haacked‘s guide

This is in global.asax for server side handling:

private void SetCulture(string currencySymbol)
{
    AjaxHelper.GlobalizationScriptPath = 
        http://ajax.microsoft.com/ajax/4.0/1/globalization/";

    var culturePref = "sv-SE";
    var request = HttpContext.Current.Request;

    if (request.UserLanguages == null)
        return;

    var lang = request.UserLanguages[0];
    if (lang != null) {
        try {
            Thread.CurrentThread.CurrentCulture =
                CultureInfo.CreateSpecificCulture(lang);
        }
        catch {
            Thread.CurrentThread.CurrentCulture = 
                new CultureInfo(culturePref);
        }
    }

    Thread.CurrentThread.CurrentUICulture = 
        Thread.CurrentThread.CurrentCulture;
}

Then on the client side I have included the following scripts:

<script src="/Scripts/jquery-1.4.2.js" type="text/javascript"></script>
<script src="/Scripts/jquery.glob.js" type="text/javascript"></script>
<script src="/Scripts/globinfo/jquery.glob.sv-SE.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $.culture = jQuery.cultures['sv-SE'];
        $.preferCulture('sv-SE');
    });
</script>
<script src="/Scripts/jquery.validate.js" type="text/javascript"></script>
<script src="/Scripts/jquery.validate.pack.js" type="text/javascript"></script>
<script src="/Scripts/MicrosoftMvcJQueryValidation.js" type="text/javascript"></script>
<script src="/Scripts/jquery.metadata.js" type="text/javascript"></script>

So far so good but it doesn’t do much. Don’t get me wrong I can still get away with using it on the client but nothing really happens on the server side. The below jQuery changes the format’s accordingly but when I post back 40,00 it becomes 0.00.

function globalizePage(culture) {
    // Set culture from select list
    $.preferCulture(culture);

    $("input[id$='Date']").val(function () {
        var dateString = $(this).val();
        var date = Date.parse(dateString);
        var dt = $.format(date, 'd', culture.name);
        return dt;
    });

    $("input[id$='Price']").val(function () {
        var price = $.parseInt($(this).val());
        var retVal = $.format(price, 'c', culture.name);
        return retVal;
    });
}

What do I need to do to make the above code work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:50:27+00:00Added an answer on May 16, 2026 at 2:50 pm

    Problem solved, bacon saved or chicken fried. The reason this is happening is that jquery.validate and jquery.glob uses a function called “format” if validate is added after glob then the validate.format function is called which breaks globalization. On the other hand validate function. I don’t know javascript or jquery good enough to tell you any workarounds. I’ll just code the validation of the form manually and forget about the MicrosoftMVCjQueryValidation since that doesn’t do the validate plugin justice.

    <script src="https://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="https://ajax.microsoft.com/ajax/jQuery.Validate/1.7/jQuery.Validate.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.glob.js" type="text/javascript"></script>
    <script src="/Scripts/globinfo/jquery.glob.sv-SE.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.forms.js" type="text/javascript"></script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying out some LINQ expressions and can't get them to work with the
I am trying to use the jquery globalization plugin (https://github.com/jquery/globalize) to work with asp.net
I am trying out some Drag Drop functionalities and can't discern the difference between
I'm new to MongoDB and trying out some fundamentals, but this astonished me. I'm
I am trying to figure out some way to get actual time via JavaScript,
Im trying out some iPhone scroll view tests, but when i load the view,
I'm using Netbean's form creator and I'm trying out some things. I'm not sure
I'm trying to filter out some garbage text from a string with regex but
I was trying out some dummy application just to test binding modes. So, just
I am trying out some on the fly code compilation using the VBCodeProvider class.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.