Carel
Carel

Reputation: 2143

ASP.NET MVC Access JavaScript Variable from within code block

I have a code block in some JavaScript on a razor page. Just before the code block I have a normal JavaScript variable. How do I access this variable from withing the Code Block?

CodeBlock

Upvotes: 1

Views: 1071

Answers (1)

Robban
Robban

Reputation: 6802

I belive you could use @:

Something like this:

if(context.Project.Find("ProjectId"){
     @:actionToTake = "ProjectOutcome";
}

or the special text-tag

if(context.Project.Find("ProjectId"){
     <text>actionToTake = "ProjectOutcome";</text>
}

Upvotes: 1

Related Questions