I am just starting with web pages and I cannot understand why the code block is not working. I need to conditionally display a WebGrid. Before starting, I have the following:
<div> @grid.GetHtml() </div>
Now I am trying to insert an if statement:
<div> @if (condition) { grid.GetHtml(); } </div>
This results in no html grid display. In fact, even without an if statement and only with a code block, I don't get html:
<div> @{ grid.GetHtml(); } </div>
Unfortunately, I am running WebMatrix, so I cannot debug, but it seems that when I use blocks of code, the instructions are not executed.
source share