Cheung
Cheung

Reputation: 15552

ASP.NET MVC, different of Razor syntax and ASP.NET syntax?

The advantage of razor syntax over asp.net syntax just using on short tag "@" instead of "<%= %>"??

Is it any other feature or data binding method razor can do, but asp.net syntax not?

Upvotes: 0

Views: 202

Answers (2)

Daniel Lidstr&#246;m
Daniel Lidstr&#246;m

Reputation: 10260

@section, @model, IntelliSense, inline C#, what else?

Upvotes: 0

Andreas Eriksson
Andreas Eriksson

Reputation: 9027

Razor is pretty cool, it can often detect if you are writing HTML code in your code blocks. So say that you are declaring a big block of C# code, by using @. You then write a foreach-loop in that, and write some HTML that should be echoed out. In ASP.net markup, you'd have to end the C# code block with %> and then reopen it with <%. Razor, on the other hand, can detect when you are writing HTML and does that for you. It will also detect where you put the bracket that closes the loop, without you having to put it within <% %>. Very handy, and a timesaver.

For more information: Click click.

Upvotes: 1

Related Questions