Welcome to MSDN Blogs Sign in | Join | Help

News

  • These postings are provided "AS IS" with no warranties, and confer no rights. Use of included code samples are subject to the terms specified Terms of Use
Tip #79: Did you know… How to quickly comment and uncomment in your web pages?

Select the lines you want to be commented in your ASPX, HTML, web config file etc  and click on the Comment/ Uncomment icon in Toolbar.

The comment icon looks like this:

 Comment Icon

The icon for uncomment looks like:

Uncomment

Alternatively you can use  Keyboard shortcut Ctrl+K Ctrl+C to comment and use Ctrl+K Ctrl+U to uncomment.

Comments in ASPX page…

Comments in ASPX page

Comment in HTML page…

Comments in HTML page

Comment in script blocks…

Script block

This shortcut is available under Edit Menu->Advance –>Comment Selection /Uncomment Selection.

Comment Uncomment Menu Option

Enjoy!

Reshmi Mangalore

SDET| Visual Web Developer

Posted: Monday, June 15, 2009 10:36 AM by WebDevTools

Comments

What's New said:

Select the lines you want to be commented in your ASPX, HTML, web config file etc  and click on

# June 15, 2009 6:56 PM

DotNetShoutout said:

Thank you for submitting this cool story - Trackback from DotNetShoutout

# June 16, 2009 10:27 AM

Steve Kaschimer said:

It works in code behind too. There are several other VERY convenient shotcuts keys in Visual Studio. Take a look at http://www.dev102.com/2008/04/17/10-visual-studio-shortcuts-you-must-know/ for more (and don't forget the comments at the bottom either)

Some of my favorites:

Ctrl-K Ctrl-D : Formats your code (including html cleanup)

Ctrl-M Ctrl-O : Collapses code to defintions only

Ctrl-Shift-B : Build (I use this one about a thousand times a day...)

Check out http://xona.com/2005/08/02.html for a handy macro to output VS keyboard shortcuts.

# June 16, 2009 10:39 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker