I know this is a simple question, but I am new to ASP MVC and just can't find the answer to this anywhere - what is the "@" that I am seeing everywhere? example:
@{
ViewBag.Title = "Welcome";
}
<h2>Welcome</h2>
<ul>
@for (int i=0; i < ViewBag.NumTimes; i++) {
<li>@ViewBag.Message</li>
}
</ul>
@ is a syntax element of Razor engine, that is used in ASP.NET MVC 3.
Your code will show text from ViewBag.Message
ViewBag.NumTimes
times.
ViewBag properties are dynamic and can be populated from controller.
Take a look http://haacked.com/archive/2011/01/06/razor-syntax-quick-reference.aspx to the Razor syntax
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With