Code is automatically wrapped to next line

N

Nathan Sokalski

I am writing code for ASP.NET, and when switching between design and HTML
view in .aspx files many of the lines that are longer than the screen width
automatically wrap to the next line. I do not like to have tags broken in
the middle (I want everything between the < and > on the same line). Is
there any way to prevent Visual Studio from breaking the tags in the middle?
Thanks.
 
P

Paul Lennon

Hi Nathan,

The best way to avoid this problem is to remember that all code will
eventually be printed one day on a printer with 80 columns. It is best
to write your code to fit the printer, not your screen. Choose for
yourself where you want your code to switch lines, don't let the editor
do it. You'll be happier in the long run.

Paul
 
N

Nathan Sokalski

I am trying to choose for myself, but Visual Studio won't let me. Every time
I switch between Design and HTML views, it reorganizes the code in HTML
view. It also does this when I initially open a file. Just like everyone
else, I have my own ways of organizing code. I won't get into the details of
it here, but one of my most important rules is to never spread an individual
tag over multiple lines. I use this rule because tags that are spread over
multiple lines increases the amount of scrolling necessary. It also makes
the indentation often used for markup languages and other languages that use
tags less efficient because not all lines start with a tag and the amount of
vertical space between an opening and closing tag is increased. And in case
you haven't noticed, when code is printed from Visual Studio the lines
automatically wrap to fit the printer (as they will with most text editors,
some just don't display a "wrap-around" symbol like VS), so spending time
worrying about what my code will look like when printed is pointless,
especially since code is almost always edited on screen.
 
E

Eliyahu Goldin

Nathan,

That's a well known Design View problem.

1. Minimize using Design View.

2. If you still need it, press Ctrl Z (Undo) every time you switch back from
Design to HTML. In most cases this will restore previous html layout.

Eliyahu
 
J

Joe Fallon

This is a well known issue and cannot really be fixed in VS 2003.
You have to work around it.
Some people never switch.
Others use Dreamweaver and copy paste changes.


Fixed in VS 2005. No more re-writing HTML.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top