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 . . . . /> –%>
Thanks so much.
Very helpful
using <%— —%> is for many lines, How would you comment out just one line of code?
Perfect solution to an annoying problem. Thanks! (found with google)
I actually googled for this Jeff and got your page. Isn’t that cool! Thanks for the tip…
Great tip … works for me.
I think it will only comment out one control at a time….
this is really cool . i too saw this behavior..
Saurabh