Home What is "#" in Razor
Reply: 1

What is "#" in Razor

Bohn
1#
Bohn Published in 2018-01-09 21:40:25Z

I am looking at a .cshtml file and I see a syntax like this:

<span>
 #if(data.PersonImage){# <img src  
</span>

I know @ is for writing C# code, I also looked at this guide below but still couldn't find what is # doing?

https://haacked.com/archive/2011/01/06/razor-syntax-quick-reference.aspx/

Camilo Terevinto
2#
Camilo Terevinto Reply to 2018-01-09 21:57:36Z

It's pretty easy to know: does it start with @?

  • Yes (and isn't followed by another @, i.e @@) => Razor
  • No => something else

What you are seeing is the Kendo UI template syntax. Similar to razor, the documentation reads:

The # (hash) sign is used to mark areas in a template that should be replaced by data when the template is executed

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.440944 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO