RSS 2.0 Feed
RSS 2.0

Atom 1.0 Feed
Atom 1.0

  Commenting out ASP.NET Server Controls 

I guess I don't need to do this frequent enough to remember this because I always seem to forget. To comment out a server control from your aspx page you cannot use <!-- and -->. Obviously, this is a server control, so you use server side comments:

<%-- <asp:Button runat=server id=button1></asp:Button> --%>


Leave a comment below.


  1. Joe Gakenheimer 8/16/2005 5:00 AM
    Same here, I forget how to do it, yet you guys were the only place on the net that I found with this info.
  2. Gray Raven 3/29/2006 9:10 AM

    I'm curious, though. What if it's a complex control that has DataBinder.Eval statements in it (which use the '<%' syntax )??
  3. Aron 7/13/2006 7:34 AM
    The %> does actually stop the comment. You can put a space between the % and the > and that makes it not notice the tag, but that is sorta a bummer. I think it should just keep on trucking till it sees --%> not just "%>".
    I guess "you can't always get what you want."
  4. Adam 12/6/2006 4:59 PM
    Thanks for putting this up on the net. Chalk up another "duh" moment for me. Found you via Google.
  5. Anonamouse 7/15/2010 6:10 AM
    i cant believe i forgot that ;)
  6. cihip 7/17/2010 10:12 PM
    Commenting out ASP.NET Server Controls thanx ;)
Comments have been closed on this topic.



Also see my CRM Developer blog