I'm trying to use razor c# in my javascript. However it's telling me: The name 'isReport' does not exist in the current context
My code is this:
<script type="text/javascript">
var isReport = false;
@if(Model.columns != null)
{
isReport = true;
}
alert(isReport);
if(isReport)
$("#reports").dataTable();
</script>
I'm trying to do the same this as in this post I think... Mix Razor and Javascript code
Thanks!