ASP 101 - Active Server Pages 101 - Web06
The Place ASP Developers Go!

Windows Technology Windows Technology
15 Seconds
ASP 101
ASP Wire
VB Forums
VB Wire
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an site
ASP 101 is an site
Internet News
Small Business
Personal Technology

Corporate Info
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash

 Top ASP 101 Stories Top ASP 101 Stories
Connections, Commands, And Procedures
What is ASP?
VBScript Classes: Part 1 of N

The big picture
Show All Tips >>
ASP 101 RSS Feed ASP 101 Updates

Quick Tips

Tidy Up That Code

Between the code I write and the code people send me to look at, I see a lot of code. Some of it's good, some of it's bad, but most of it is just plain ugly! While you may not deal with as much code as I do, most developers at some point in their careers get thrown into the ring with someone else's ugly old code.

I used to use the venerable HTML Tidy to get the HTML portions of really ugly ASP code to a point where I could at least figure out what was going on. These days I find myself using Tidy less and less, and it's not because the stuff I get sent has gotten any prettier.

The tool I've been reaching for recently is the "Format Selection" command in Visual Web Developer and Visual Studio 2005. It handles both HTML and code areas and is built right into the development environment.

In order to use it you simply highlight the section of code that you want to reformat, right click, and choose "Format Selection". Almost instantly the ugly code is gone and in its place is shiny new code ready for editing (or in my case publication). And best of all, it almost never messes up the output from the page... when viewed in a browser the page should look just as it did before.

Oh and if for some reason you don't like the style of the resulting code, you can even customize the formatting rules that are used to clean the code. If you select "Formatting and Validation..." from the pop-up menu, you will be taken to a dialog box that will let you tweak the output to your heart's content.

Previous      Show All Tips      Next

If you have a tip you would like to submit, please send it to:

Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback
The Network for Technology Professionals



Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers