Trying to pass in a boolean C# variable to a javascript variable and set it to true

前端 未结 5 1486
名媛妹妹
名媛妹妹 2021-02-02 05:28

Having issues where in my .aspx page I pass in a boolean variable (C#) to a javascript function that is expecting a boolean type.

BUt the C# variable returns True, and j

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-02 05:53

    The other answers are targeting the old version, before Razor
    if you are using Razor then this is the solution

    myjavascript( @MyBooleanVariableInCSharp.ToString().ToLower() );
    

提交回复
热议问题