Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

ASP.NET MVC: Comparing same view on ASP.NET and Razor view engine

DZone's Guide to

ASP.NET MVC: Comparing same view on ASP.NET and Razor view engine

·
Free Resource

I ported views of my ASP.NET MVC application from ASP.NET to Razor. Although Razor is very new it is very promising view engine because of shorter and cleaner syntax. In this posting I will show you same view on ASP.NET and Razor view engine. I like Razor one more but what do you think?

My contacts table on ASP.NET view engine is here. You can open both images on separate windows and switch between them to see differences.

Contacts index on ASP.NET

And here is the same view in Razor. Notice that ASP.NET MVC 3 RC has support for Razor syntax highlight. Click on image to view it at original size.

Contacts index on Razor

If you see these images at original size you see the effect.

For me Razor view is easier to read because there is less noise caused by template symbols. I think this view is not complex one. If there are more loops and conditionals in our view then I am sure ASP.NET version of it looks messier.

Topics:

Published at DZone with permission of Gunnar Peipman, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}