Using regions in ASP.NET

09/26/10

Permalink 06:22:03 pm, by dave Email , 216 words, 9425 views   English (US)
Categories: ASP.NET

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

Leave a commentTrackback (0)

Did you like this post? If so, Share it!  del.icio.us digg reddit slashdot this article Facebook Twitter MySpace Email

Trackback address for this post:

http://davemoats.com/blog/htsrv/trackback.php/315


Comments, Trackbacks, Pingbacks:

No Comments/Trackbacks/Pingbacks for this post yet...

This post has 1605 feedbacks awaiting moderation...

Leave a comment:

Your email address will not be displayed on this site.
Your URL will be displayed.

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
(Line breaks become <br />)
(Set cookies for name, email and url)
(Allow users to contact you through a message form (your email will NOT be displayed.))

Development

A place to keep track of development ideas, finds, and fixes

Search

Follow Me:

Categories

Archives

Misc

Who's Online?

  • Guest Users: 1

powered by b2evolution free blog software