Gunnar Peipman's ASP.NET blog

ASP.NET, C#, SharePoint, SQL Server and general software development topics.

Sponsors

News

 
 
 
 
 
DZone MVB

Links

Social

ASP.NET MVC 3 Beta: Razor views support comments now

Sometimes we need server-side comments in ASP.NET MVC views. New version of Razor view engine supports comments in views and in this posting I will show you example of view with multiline comments.

I will use the view from my ASP.NET MVC charts caching example and add one multiline comment to this view. Note that comments are put between @* and *@ marks.


@{
    View.Title = "Home Page";
}
 
<h2>@View.Message</h2>
<p>
    @* 
        Charts area 
        -----------
        1. cached for 10 minutes by default
        2. cached for 180 minutes
    *@
    <img src="/Home/MyChart" />
    <img src="/Home/MyCachedChart" />
</p>

NB! This is only example. Don’t write long stories to the comments of your views. Add comments only if it is necessary and if it helps UI developers to communicate better with the presentation layer or model.

Comments

DotNetShoutout said:

Thank you for submitting this cool story - Trackback from DotNetShoutout

# October 18, 2010 5:25 AM

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# October 18, 2010 5:27 AM

progg.ru said:

Thank you for submitting this cool story - Trackback from progg.ru

# October 18, 2010 5:27 AM

Twitter Trackbacks for ASP.NET MVC 3 Beta: Razor views support comments now - Gunnar Peipman's ASP.NET blog [asp.net] on Topsy.com said:

Pingback from  Twitter Trackbacks for                 ASP.NET MVC 3 Beta: Razor views support comments now - Gunnar Peipman's ASP.NET blog         [asp.net]        on Topsy.com

# October 18, 2010 5:31 AM

NWebSolution said:

Thnx..It is very good story

# October 18, 2010 10:18 AM

Interesting .NET Links - October 18 , 2010 | Tech Blog said:

Pingback from  Interesting .NET Links - October 18 , 2010 | Tech Blog

# October 18, 2010 12:13 PM

The Morning Brew - Chris Alcock » The Morning Brew #710 said:

Pingback from  The Morning Brew - Chris Alcock  &raquo; The Morning Brew #710

# October 19, 2010 3:04 AM

Bali5 said:

it supported until Beta not official but worked with

@// comment

we're very for this loss :(

# October 25, 2010 8:54 AM

Prog.Hu said:

# November 12, 2010 3:52 AM

fix error 1335 said:

I’ve been visiting your blog for a while now and I always find a gem in your new posts.  Thanks for sharing.

# December 10, 2010 3:35 PM

fenske auctions said:

Thanks For This Post, was added to my bookmarks.

# April 19, 2011 7:04 PM

Cheap oem software said:

xHcS1w Good! Wish everybody wrote so:D

# September 23, 2011 2:32 PM

Bielizna Sklep said:

Hey there just wanted to give you a quick heads up and let you know a few of the pictures aren't loading properly. I'm not sure why but I think its a linking issue. I've tried it in two different browsers and both show the same results.

# December 19, 2011 10:07 PM

social said:

Thanks-a-mundo for the article post.Thanks Again.

# May 8, 2012 5:25 AM

social said:

rREDKV Say, you got a nice post.Much thanks again. Really Cool.

# May 11, 2012 6:12 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)