VS.NET Tip: Collapsing Lines in an ASPX or HTML File

Wednesday, March 24, 2004 9:14 AM
Microsoft MVP Logo

    I just HAD to pass this along.  Just today I was bitching about not being able to hide long ASP code in a legacy project I'm maintaining.

    One of the things I love about the C# editor in VS.NET is how it lets you collapse regions into a little plus sign. Then when I want it back I can just click to plus to see what's there.

    I'm currently working on a Windows SharePoint Services (WSS) Site Definition and I'm using VS.NET to edit the template ASPX files. What I really wanted was a way to collapse table and div tags down into plus signs so I could get the out of my way.

    Well, it turns out you can do it!

    Here's how:

    Select the text you want to collapse, and choose Outlining | Hide Selection from the Edit menu (or just use CTRL-M, CTRL-H).

    POW! The file now has a collapsed region. You can open and close that region by clicking the plug sign or using CTRL-M, CTRL-M.

    Very cool.

    BTW… so far this works in any text file you open in VS.NET. We'll see if that keeps up.


    [Geek Noise]

    comments powered by Disqus