ASP.NET MVC and Angular Training in Mumbai :- @Razor and JavaScript

Again a big thanks to our students to make our MVC training in Mumbai Andheri successful. It was small batch of 4 people and this time we had some people travelling from Pune as well.

One of the interesting learning that happened in this MVC training was razor symbol and javascript clash.

We had a very simple javascript code which was running inside razor engine and we wanted to set a twitter id to the javascript variable. But because the twitter id had a “@” symbol razor was throwing exception.


In case you are thinking that with two “@@” it should work and then let me confirm it will not.We wanted to display in the javascript alert only one ‘@’ so this was not the solution for it.


This was solved by using “Html” helper. So from the server side we will tell HTML helper to parse the “@” and set send it as javascript code to the browser. This worked a like a charm. We understand its not a great solution but it solved our problem.

var twitter = @Html.Raw("'@shivkoirala'");

Thanks to our participants to attend this MVC training our next MVC training will start this coming Saturday and Sunday. Do not miss our 16 hours of action in our Mumbai Andheri training institute. For syllabus and venue you can see this link



This entry was posted in Angular Mumbai Training, Class Room Training, MVC and tagged , , . Bookmark the permalink.

4 Responses to ASP.NET MVC and Angular Training in Mumbai :- @Razor and JavaScript

  1. Vikramaditya Shinde says:

    Hi Sukesh ,

    Please let me know the training schedule in March 2016.Also need to know what will be cover in next sessions.

    View Comment
  2. Rashmi says:


    I want to attend Mvc training.
    When you are conducting next session?
    I also want to know what topics you cover in 2 days?

    View Comment

Leave a Reply

Your email address will not be published. Required fields are marked *