Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138163

Access model property from javascript

$
0
0

I have an ASP.NET MVC project and I am trying to access a model property (isNew) from the view (.cshtml) and from within javascript function so I am performing below without success:

@model My.Common.DTOs.MyDTO

function Initizalize()
{
   if (!@Model.isNew)
   {
      DoSomeStuff(); // call another javascript function
   }   
}

function DoSomeStuff()
{
}

Viewing all articles
Browse latest Browse all 138163

Trending Articles