Accessing ASP.NET MVC model data from with Javascript

后端 未结 3 607
天命终不由人
天命终不由人 2021-01-14 19:17

I have a strongly typed View that accepts a Customer model, this customer model is a LINQ2SQL partial class that has a property called Journeys which returns all Journeys th

3条回答
  •  梦谈多话
    2021-01-14 20:02

    This question has long been answered (and accepted), but I wanted to pass along a response to a similar question that helped me. His answer takes advantage of MVC3/Razor syntax:

    https://stackoverflow.com/a/7486214/249153:

    In mvc3 with razor @Html.Raw(Json.Encode(object)) seems to do the trick.

提交回复
热议问题