Back to list
Views:   12.2K
Replies:  2

Do you have ASP.NET MVC 3 Razor experiences to share?

I am absolutely new to MVC 3 and trying learn some details. 

I was wondering whether anyone has any real-world experiences to share about the new ASP.NET MVC 3 Razor View Engine.
Specifically, what is the learning curve when coming from the traditional ASPX View Engine?

Also, what about the .cshtm extensions. Does this affect deployment in any way?  Or does the Routing system shield you from this?
Finally, the new Master page replacement, called _layout page. How different is that from Master pages?

Walt Lynton, Mar 15, 2011
Reply 1
Some additional tips

There are few important tips that may be of help while working with razor.

1.  By default all outputs are html encoded
2.  @Html.Raw (for outputting string with html tags) 
3. <img src="@(model).Path"/>   : here model is the model or domain object and to avoid conflict enclose this in parenthesis. 
    "Path is the propery on the model.  This makes building dynamic attributes a breeze.
4. <text> hello world </text> :  Anything put in a text tag is outputted as it is.  i.e. no <text> markup is rendered.  This is used
     for outputting plain text without any markup surrounding it.
5. _viewstart.cshtml :  Move you common view code here.  Like setting up the layout pages....
6.  @@ :   escape @character.  :  If you need to emil @mysite  then prefix it with an @ to escape the special meaning. 
     eg.. @@mysite.

Rajesh Pillai, Apr 16, 2011
Reply 2

Presently evaluating for a project.   Some answers to your questions

1.  Easy to learn (seem odd at first, but you can quickly get comfortable with it).
2.  .cshtml has no effect on deployment in any way.
3.  Routing work as usual
4.  Layout page is different in the sense that certain new way of marking child sections rather than the usual contentplace holder.

You may find the following resources helpful./


Running ASP.NET MVC on a shared hosting server

Here are some code samples

Hope this helps.. I will share my experience as I move along with this.

Rajesh Pillai, Mar 15, 2011
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.