This website may use cookies. More info. That's Fine x
Welcome Login

Visual studio: Collapsible and expandable option in view or aspx page

To turn on the collapsible/expandable option:


1. select the section of code you want collapible in view or aspx page.

2. Press Ctrl + M + H


To turn off the collapsible/expandable option:

3. Press Ctrl + M + U

Note: to remove the option you really don't need to select the section back again. You can just place the cursor anywhere in the defined block and press the Ctrl + M + U option to remove the options.


Although you would use this in a view or aspx page, this functionality applies to visual studio code editor too.  But #region directive is probably better applied here.



Eg: to enable collapsible option:




Eg2: collapsible option in vs editor code:




For more information, see here.

Or here.

Created on: Wednesday, February 8, 2017 by Andrew Sin