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

  • Home
  • SEARCH
  • 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 8680703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:19:01+00:00 2026-06-12T21:19:01+00:00

I have the following code in a c# MVC 3 razor page where I

  • 0

I have the following code in a c# MVC 3 razor page where I am passing serialized data into a javascript variable for KnockoutJs:

    @{   
        var listData = new JavaScriptSerializer().Serialize(Model.ListItems);
        var pagerData = new JavaScriptSerializer().Serialize(Model.Pager);
    }


// additional code

    <script type="text/javascript" >

        var ListData = @(Html.Raw(listData));  // <-- Syntax Error here
        var PagerData = @(Html.Raw(pagerData));  // <-- Syntax Error here

     // additional js code

    </script>   

After upgrading to VS 2012, I am getting error squiggles after the javascript semi-colons at the end the Html.Raw lines above. The project complies but VS 2012 displays ‘Syntax Error’ in the Error List for each line. Without the semi-colons the javascript also shows a ‘Syntax Error’.

This code worked without issues in the previous version. Is this a bug in the VS 2012 parser and is there a way to avoid the generated errors?

Edit
Anyone else seeing this issue? Below is a simplified version with the same issue isolated in a new page. If you add a semi-colon at the end of the ListData line you get a javascript syntax error, without one it is on the next line. Is this a bug in the javascript compiler between VS2010 and VS2012?

@{   
    var listData = "test";
    var pagerData = "test2";
}
    <script type="text/javascript" >
        var ListData =  @(Html.Raw(listData))
        var PagerData =  @(Html.Raw(pagerData))
    </script>
  • 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-12T21:19:02+00:00Added an answer on June 12, 2026 at 9:19 pm

    Please add vote on this connect issue. We will address this issue in next version of VS. I have attached your repro code to this bug and added link to this post as another manifestation of the issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code for inserting data into database using PDO. It inserts data
I have following code. ASPX Page <a href=AnyASPXPageOfWebsite.aspx onclick=javascript:CallJQuery(); > Set Price </a> JS
I have the following code in an MVC 3 view <% foreach (var stockItem
I have the following code in a MVC 3 (Razor) project: <div class=user_info id=id_user_info>
Let's say I have the following code on my view page (in asp.net mvc
i have the following code in an asp.net mvc view. <% = Html.DropDownList(Filter, new
I have the following code, deployed on a https Asp site, build with MVC
This is a beginner level question for asp.net MVC I have the following code
I have the following code (asp.net-mvc, jquery) (i have simplified the example to show
i'm new to routing in aspnet mvc.. i have following code: Action Controller public

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.