Mixing text and functions inside an if/else with MVC Razor

The contents of a code block ({ ... }) are expected to be code, not markup.

If you want to put text directly in a code block, you have three choices:

  • Wrap it in any HTML tag
  • Wrap it in the special Razor <text> tag, which will just render the text without the tag
  • Prepend the line with @:, which is equivalent

See SottGu’s blog post.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)