CodeKicks.com
Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Saturday, August 26, 2006

Server Side Comments with ASP.NET 2.0

Problem

 

You are coding away on an ASP.NET page, and are trying to isolate a problem within the page.  You have some existing html/controls/markup/in-line code that is being used on the page, and you want to temporarily comment it out while you fix the problem.

 

Solution

 

ASP.NET supports a little known feature called “server-side comments” that you can use to completely disable code/controls/html in a page.  Server-side comments in ASP.NET are delimited using a <%-- --%> syntax.  For example:

 

        <%--

            Commented out HTML/CODE/Markup.  Anything with

            this block will not be parsed/handled by ASP.NET.

       

            <asp:Calendar runat="server"></asp:Calendar> 

 

            <%# Eval(“SomeProperty”) %>     

        --%>

Continuee from ScottGu’s

 

Technorati Tags:
43 Things Tags:
Buzzwords (Buzznet) Tags:
Del.Icio.Us Tags:
Flickr Tags:
Ice Rocket Tags:
LiveJournal Tags:

 

Post a Comment