0

I am studying about passing multiple models to view by using various methods. However when I wrote this line:

var allFaculties = @Html.Raw(Json.Encode(ViewData["Faculties"]));

I am getting a syntax error:

returns mark up that is not html encoded

How can I solve this issue?

UPDATE I am using MVC4 ,is there any additional changes i have to do.

peter
  • 8,158
  • 21
  • 66
  • 119
  • Show us the ViewData["Faculties"]) content – Fals May 02 '15 at 14:38
  • 2
    Do this way: http://stackoverflow.com/questions/18872720/how-to-get-to-model-or-viewbag-variables-in-a-script-tag/18873175#18873175 – Fals May 02 '15 at 14:41
  • @ Fals i did everything as per the link ,dittoo http://www.codeproject.com/Articles/687061/Multiple-Models-in-a-View-in-ASP-NET-MVC-MVC – peter May 02 '15 at 14:58
  • Answer is provided in this link http://stackoverflow.com/questions/18872720/how-to-get-to-model-or-viewbag-variables-in-a-script-tag/18873175#18873175 – peter May 02 '15 at 20:33

0 Answers0