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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:54:44+00:00 2026-06-07T16:54:44+00:00

I have seen some posts regarding this topic and a few blogs, but none

  • 0

I have seen some posts regarding this topic and a few blogs, but none seem to mention the output I’m getting.

What I want is to generate a google maps map with information on it. Manually entering the information results in the correct information. So that part works.

Where I’m getting stuck is when I’m going to dynamiccaly create the javascript array with the string with the information I want on my map.

The html code I want to get is:

<script type="text/javascript">     
    var projects = [
         ['Kantoor 4.1 bestaande bouw', 52.25446, 6.16024700000003, 'Deventer', '', 'adviseurs', 'rating30'],
         ['School nieuw 4.0', 52.243161, 4.43677860000003, 'Noordwijk', '', 'adviseurs', 'rating30'],   
    ];

Very simple javascript array, which I thought to create with:

<script type="text/javascript">
var projects = [
    @foreach (var item in Model)
    {
        @HttpUtility.JavaScriptStringEncode("['" + item.Gebouwnaam + "', " + item.LocatieLatitude.ToString().Replace(",", ".") + ", " + item.LocatieLongitude.ToString().Replace(",", ".") + ", '" + item.Plaats + "', '" + item.Gebruiksfunctie + "', '" + item.Licentiehouder + "', '" + item.rating + "'],");
     }
];
</script>

However this gives me:

<script type="text/javascript">
var projects = [
    [\u0027Kantoor 4.1 bestaande bouw\u0027, 52.25446, 6.16024700000003, \u0027Deventer\u0027, \u0027\u0027, \u0027adviseurs\u0027, \u0027rating30\u0027],
    [\u0027School nieuw 4.0\u0027, 52.243161, 4.43677860000003, \u0027Noordwijk\u0027, \u0027\u0027, \u0027adviseurs\u0027, \u0027rating30\u0027],
];  
</script>

Escaping the single quotes doesn’t work.
What am I doing wrong?

  • 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-07T16:54:45+00:00Added an answer on June 7, 2026 at 4:54 pm

    Just tried with

     <script type="text/javascript">
     var projects = [
    
       @Html.Raw("['" + "aaa" + "', '" + "bbb" + "'],")
    
    
     ];
     </script>
    

    it worked and showed …

    <script type="text/javascript">
    var projects = [
    
           ['aaa', 'bbb'],
    
    
    ];
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, apologize because I have seen some posts about this, but I
I have seen some of the other answers on this topic but dont really
I've seen some posts on here regarding similar ideas to this, but to be
I have seen some related questions but none focusing on the specific problem I
Possible Duplicate: Dynamically adding collapsible elements I've seen a few posts on this but
I have seen some other posts on how to get this working ... however
I have seen this on some posts: $num = 5; if(((int)$num) < 4){ ...}
I know other posts have been made regarding this, but so far the answers
I have seen some posts that mention the xmlserializer being called at runtime in
So I have seen some other posts similar, but not quite answering what I

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.