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 8164769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:23:25+00:00 2026-06-06T19:23:25+00:00

I’m trying to use json for my web page’s globalization options.. id like to

  • 0

I’m trying to use json for my web page’s globalization options.. id like to change the labels of my form just by using a little dropdownbox and without refreshing the whole page and more interesting part is i got more than two form in my view.

so far i have done this:

My Json:

public JsonResult Globalx(String incoming)
{
    System.Globalization.CultureInfo Cult = new System.Globalization.CultureInfo(incoming, true);
    System.Threading.Thread.CurrentThread.CurrentCulture = Cult;
    System.Threading.Thread.CurrentThread.CurrentUICulture = Cult;
    Resources.Global.Culture = System.Threading.Thread.CurrentThread.CurrentCulture;
    Global.ResourceManager.GetResourceSet(Cult, false, true);

    ViewData["Name"] = Global.Name;
    ViewData["Surname"] = Global.Surname;
    ViewData["Birth"] = Global.Birth;

    String lnginfo = Resources.Global.Culture.TwoLetterISOLanguageName.ToString();
    ViewData["Languages"] = new SelectList(myList, "Value", "Text", lnginfo);


    return Json(ViewData, JsonRequestBehavior.AllowGet);
}

My View:

@model MyCustomers.Models.Customers
@{
    ViewBag.Title = ViewData["NewCustomer"];
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script type="text/javascript" language="javascript">

$(document).ready(function () {
    function changeLang() {
        var lang = $("#LanguageBox").val();
        $.getJSON('@Url.Content("~/Home/People/")', { incoming: lang }, function (data) {
            // what should i do here to get my label's language changed?
        })
    }
}

</script>

@using (Html.BeginForm("Index", "Home", FormMethod.Post, new { enctype = "multipart/form-data", id = "LanguageForm" }))
{
<fieldset>
    <legend>@ViewData["LanguagesTitle"]</legend>
    @Html.DropDownListFor(x => x.SelectedLanguage, (SelectList)ViewData["Languages"], new { onchange = "changeLang()", id = "LanguageBox" })
</fieldset>
}

@using (Html.BeginForm("PeopleForm", "Home", FormMethod.Post, new { enctype = "multipart/form-data", id = "PeopleForm" }))
{
<fieldset>
    <legend>@ViewData["SalesContract"]</legend>
        <div>
            <div class="Name">
                @Html.Label(ViewData["Name"].ToString()) <!--> HERE </!-->
                @Html.EditorFor(x => x.People.Name)
            </div>
            <div class="Surname">
                @Html.Label(ViewData["Surname"].ToString()) <!--> HERE </!-->
                @Html.EditorFor(x => x.People.Surname)
            </div>
            <div class="Birth">
                @Html.Label(ViewData["Birth"].ToString()) <!--> AND HERE </!-->
                @Html.EditorFor(x => x.People.Birth)
            </div>
        </div>
</fieldset>
}

No im not actually using this method im refreshing the whole page each time to change the language of my labels but some friend of mine told me it could be done without refreshing and the first thing that came in my mind was Json.. I dont know if its possible or not im just trying. Any other ideas are wellcome.

I think the title is a little confusing and im asuming my problem here is understood so if anyone can find a better title please attempt to fix it.

  • 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-06-06T19:23:26+00:00Added an answer on June 6, 2026 at 7:23 pm

    In your Json result you would need to identify each of the labels that you have provided the text for, say each label has a Json object:

    Id: 'label1',
    Text: 'Enter your first name'
    

    You provide one of these objects for each label on your page in an array,

    {Id: 'label1', Text: 'Enter your first name'},
    {Id: 'label2', Text: 'Enter your second name'},
    {Id: 'label3', Text: 'Enter your telephone number'},
    

    Then you deal with each of these on the requesting end,

    $.getJSON('@Url.Content("~/Home/People/")', { incoming: lang }, function (data) {
        for(i = 0; i < data.length; i++){
            $('#'+data[i].Id).Html(data[i].Text);
        }
    })
    

    I’m not 100% sure that Html will be the best thing to use – there may be sub DOM elements created by MVC that would need to be taken into account in your selector.

    If you wanted to stick to the method you’re using now you’ll need to hard code each of the assigned values one at a time.

    $.getJSON('@Url.Content("~/Home/People/")', { incoming: lang }, function (data) {
        $('#Name').Html(data['Name']);
        $('#Birth').Html(data['Birth']);        
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

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.