The time in Italy is:
Monday, 19 Apr 2021
You are here: HomeArticlesUsing Razor, how do I render a Boolean to a JavaScript variable

Using Razor, how do I render a Boolean to a JavaScript variable

In this article you can find how render a Boolean to a JavaScript variable in a cshtml file

<script type="text/javascript">
    var myViewModel ={
        isFollowing: @Json.Encode(Model.IsFollowing) // This is a T# bool };
</script>

Last modified on Wednesday, 17 February 2016 09:28

Comments  

0 # Using Razor, how do I render a Boolean to a JavaScript variableKisha 2016-03-19 07:14
Another good one.

Here is my site; removals (myspace.com: https://myspace.com/nastysavior6601/post/activity_profile_17276181_c86f7c3225364bb6ad2fe44ae932c6b0/)
Reply
0 # RE: Using Razor, how do I render a Boolean to a JavaScript variableNicola Slobbe 2016-05-03 07:53
Thank you for your comment.
Reply

Add comment


Security code
Refresh

Go to top