views:

348

answers:

4

I'm using Visual Studio 2008 for an ASP .Net application, and Visual Studio keeps adding blank lines to my aspx file whenever I save, switch to design mode and back to code view, switch to split mode, or switch between files. Before I save, I will have:

                        </ContentTemplate></asp:UpdatePanel>
                    </ContentTemplate>
                </ajax:TabPanel>
            </ajax:TabContainer>

Then, it will magically transform into:

    </ContentTemplate></asp:UpdatePanel>


</ContentTemplate>















</ajax:TabPanel>
                    </ajax:TabContainer>

I know it's mostly an aesthetics issue, but it's also adding 17 lines of nothing to each tab container (and making the file that much longer to scroll through) and it's very annoying. I've checked that I don't have a misplaced quotation mark, there's no misaligned tags earlier in the file, any ideas?

A: 

I can't say I've ever experience this with any Visual Studio yet, but try this

Ctrl-E, D command will automatically reformat the document. (Assuming C# Development Enviroment)

Ctrl-K, Ctrl-D for Web Development Enviroment

If the document remains as it is with the incorrect spacing then the auto format is the problem. Simple disable the auto-format inside Options->Text Editors->HTML->Formatting

ShaneB
+2  A: 

The only time I've seen Visual Studio do something close to this is when the XML/HTML in question is invalid, for example you are missing a closing tag somewhere.

tbreffni
A: 

Did you find solution to this issue...I am having same problem. Frequently it will reformat to place entire contents of tab panel on single line. Other times it appears to HTML encode the content replacing spaces and quotes. Very odd...

lauren
For me, it ended up being an issue with some that was commented out JavaScript earlier in the document and that ended up like this: <!-- /* --> */, but Visual Studio wasn't catching the error. Like tbreffni said, check for formatting issues elsewhere.
weffey
A: 

For reasons unknown tab container appears to temporarily render in design environment with long string which seems to cause insertion of blank lines with default settings. Turing off the tag wrapping, seemed to work for me.

Tool/Options/

[Show all settings]

Text Editor/HTML

Wrap tags when exceeding specified lenght

If any interested.

lauren