Sorry for the newbie question.
When passing a boolean value from a controller to a view using ViewData, how do I get it as a boolean in javascript? Example:
Controller:
ViewData["login"] = true;
View
<script type="text/javascript">
var login = <%= (bool)ViewData["Login"] %>;
</script>
Of course i can do
<script type="text/javascript">
var login = '<%= ViewData["Login"] %>';
</script>
But I rather save the input object as a boolean, and a string if possible
Thank!
source
share