Back to list
Views:   0
Replies:  0
Archived

,
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./

http://weblogs.asp.net/scottgu/archive/2010/10/22/asp-net-mvc-3-layouts.aspx

http://weblogs.asp.net/scottgu/archive/2010/12/30/asp-net-mvc-3-layouts-and-sections-with-razor.aspx


Deployment
http://www.hanselman.com/blog/BINDeployingASPNETMVC3WithRazorToAWindowsServerWithoutMVCInstalled.aspx

Running ASP.NET MVC on a shared hosting server
http://weblogs.asp.net/scottgu/archive/2011/01/18/running-an-asp-net-mvc-3-app-on-a-web-server-that-doesn-t-have-asp-net-mvc-3-installed.aspx

Here are some code samples
http://archive.msdn.microsoft.com/aspnetmvcsamples/Release/ProjectReleases.aspx?ReleaseId=5114


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     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas