Accessing MVC's model property from Javascript RRS feed

  • Question

  • How do I access one of the above properties from Javascript?


    @using SayacSonuc.Models
    @model tablodeneme
    @using Newtonsoft.Json
        ViewBag.Title = "Anasayfa";
        Layout = "~/Views/Shared/_Layout.cshtml";
        var isEdit = '@Model.NET' // Here data
    function getEdit() {
        console.log(isEdit); // but not log 

    Saturday, January 25, 2020 7:13 AM

All replies

  • ask at forums.asp.net. this forum is for ado.net. 

    Visual C++ MVP

    Saturday, January 25, 2020 9:22 AM
  • Hi Anıldmrtas,

    As Sheng Jiang 蒋晟 mentioned, it is better to post your issue on asp.net forum for suitable support. 

    In addition, you could take your entire server-side model and turn it into a Javascript object by doing the following:

    var model = @Html.Raw(Json.Encode(Model));

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 27, 2020 2:24 AM