Jeffrey Palermo (.com)

Sponsors

The Lounge

Wicked Cool Jobs

News

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
How to comment out an ASP.NET server control - doesn't work - level 100

I was performing some testing, so I commented out a bit of my ASP.NET markup with <!-- --> because, after all, I've used that for years, right?  Well, it took me just a sec to figure out that the server control was still being executed and that the <!-- was just rendered before it on the client.  The important bit:  <!-- is HTML syntax, not server-side syntax.  If you want to comment out a server control, use the following syntax:

<%--   <asp:Button . . . . />  --%>

 


Posted Mon, Nov 22 2004 6:13 AM by Jeffrey Palermo

[Advertisement]

Comments

saurabh wrote re: How to comment out an ASP.NET server control - <!-- --> doesn't work - level 100
on Mon, Nov 22 2004 3:59 AM
this is really cool . i too saw this behavior..

Saurabh
Michael Polo wrote re: How to comment out an ASP.NET server control - <!-- --> doesn't work - level 100
on Wed, Dec 8 2004 4:38 AM
I think it will only comment out one control at a time....
Jason Hoekstra wrote re: How to comment out an ASP.NET server control - <!-- --> doesn't work - level 100
on Thu, Dec 9 2004 5:41 PM
Great tip ... works for me. :)
Ken Jackson wrote re: How to comment out an ASP.NET server control - <!-- --> doesn't work - level 100
on Mon, Jan 10 2005 12:10 PM
I actually googled for this Jeff and got your page. Isn't that cool! Thanks for the tip...
Jeffrey Palermo wrote re: How to comment out an ASP.NET server control - <!-- --> doesn't work - level 100
on Tue, Apr 12 2005 10:45 AM
Perfect solution to an annoying problem. Thanks! (found with google)
Jeffrey Palermo wrote re: How to comment out an ASP.NET server control - <!-- --> doesn't work - level 100
on Fri, Apr 22 2005 6:37 PM
using <%--- ---%> is for many lines, How would you comment out just one line of code?
Jeffrey Palermo wrote re: How to comment out an ASP.NET server control - <!-- --> doesn't work - level 100
on Sun, May 1 2005 12:09 PM
Thanks so much.
Very helpful
Devlicio.us doesn't work - level 100" trackback:ping="http://codebetter.com/blogs/jeffrey.palermo/trackback.ashx?PostID=33047" /> -->