Here’s what I’m trying to do:
$(document).ready(function () {
@if (ViewBag.VerifyIfLoggedIn) {
$("#needlogin-popup").dialog({
modal: true,
closeOnEscape: true,
minHeight: 384,
minWidth: 596,
resizable: false,
show: {
effect: 'slide',
duration: 500,
direction: 'up'
},
hide: {
effect: 'slide',
duration: 250,
direction: 'up'
},
title: 'Inicie Sesion'
});
}
});
If something is true, then output this Javascript code to the page.
But I’m getting the error:
CS1056: Unexpected character ‘$’
How can I tell Razor to stop parsing and output whatever is in the conditional statement?
Use
<text>...</text>around the code.Read on how it works here:
http://weblogs.asp.net/scottgu/archive/2010/12/15/asp-net-mvc-3-razor-s-and-lt-text-gt-syntax.aspx