Community > Discussions
66 views
1 replies

How can I add a code block to a Visualizer template

Something simple like

@{ var myMessage="Hello World";}

does not work.

I want to do something like this:

<!-- Multi-statement block -->
@{
var greeting = "Welcome to our site!";
var weekDay = DateTime.Now.DayOfWeek;
var greetingMessage = greeting + " Here in Huston it is: " + weekDay;
}
<p>The greeting is: @greetingMessage</p>

 

Scott Tremain Scott Tremain
Published 01/15/2021 12:37
Add Comment
Ashish Pachori

Your provided code is correct, It is working for me in Live Visualizer.

replied 01/15/2021 13:43

Last Activity 01/15/2021 13:43