Thursday, 3 September 2015

How to convert C# bool to Javascript boolean in Razor .cshtml views

I was wanting a clean way to convert a C# Boolean property on a view model into a javascript true / false bit of text for passing into our Typescript context settings constructors, and stumbled upon this way …

@Json.Encode(Model.BoolPropertyName)

clip_image002

Works a treat too!

clip_image004

1 comment:

  1. Merrick Chaffer'S Blog: How To Convert C Bool To Javascript Boolean In Razor .Cshtml Views >>>>> Download Now

    >>>>> Download Full

    Merrick Chaffer'S Blog: How To Convert C Bool To Javascript Boolean In Razor .Cshtml Views >>>>> Download LINK

    >>>>> Download Now

    Merrick Chaffer'S Blog: How To Convert C Bool To Javascript Boolean In Razor .Cshtml Views >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete

How to find the last interactive logons in Windows using PowerShell

Use the following powershell script to find the last users to login to a box since a given date, in this case the 21st April 2022 at 12pm un...