09/26/10
Using regions in ASP.NET
I have been doing some ASP.NET coding recently I was looking for a way to use the #region directive in Visual Studio 2010 to manage sections of the aspx files. I really wanted to be able to collapse and expand the region sections to make it easier to navigate the files. I searched for some solutions, but did not find anything. What I did find was a post about using #regions in javascript files. The solution was written for Visual Studio 2008 and with a little [very little tweaking], I was able to use the same solution for my need. I started with this post and made the following changes in order to get it to work for me.
First I changed these two lines from:
Code:
Const REGION_START As String = "//#region" | |
Const REGION_END As String = "//#endregion" |
TO:
Code:
Const REGION_START As String = "<%--#region" | |
Const REGION_END As String = "#endregion--%>" |
Then I changed the macro mapping from Ctrl+M Ctrl+E to Ctrl+A Ctrl+P.
Other than these two changes, I followed the instructions from this post verbatim.
Now I can add region tags to my ASP.NET files, run the macro [each time I load the file - including after a debugging session] and collapse and expand those sections as needed.
Cheers,
Dave
Search
Follow Me:
Archives
Misc
Who's Online?
- Guest Users: 1




