Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stop VS.net from changing html code in aspx file

Status
Not open for further replies.

harmmeijer

Programmer
Joined
Mar 1, 2001
Messages
869
Location
CN
When I view an aspx file in design mode and then go to html view all my layout is gone.
VS.net makes an unreadable mess of it.

For example:
Code:
<asp:Panel 
      id=&quot;pnlContent&quot; 
      style=&quot;Z-INDEX: 103; LEFT: 145px; POSITION: absolute; TOP: 129px&quot; 
      runat=&quot;server&quot; 
      Height=&quot;205px&quot; 
      Width=&quot;533px&quot;> 
            <!--#include file=&quot;sample&quot;-->
</asp:Panel>
Turns into:
<asp:Panel id=&quot;pnlContent&quot; style=&quot;Z-INDEX: 103; LEFT: 145px; POSITION: absolute; TOP: 129px&quot; runat=&quot;server&quot; Height=&quot;205px&quot; Width=&quot;533px&quot;> <!--#include file=&quot;sample&quot;--></asp:Panel>

If many html elements are nested like this with an incredably long list of propertys then puttig the lot on one long line is a sure way to never understand the html code later.

Can I change some setting that prevents vs from doing this?




Greetings, Harm Meijer
 
OK, it seemed to be under:
tools -> options -> Text Editor -> format -> unchecked &quot;When saving document&quot; and &quot;When switching from design to HTML/XML view&quot;



Greetings, Harm Meijer
 
It's one of the &quot;features&quot; of the IDE. The next release of VS.NET (Whidbey) will disable the markup highjacking.
 
Yes, I think this is not one of the best features because it does't format verry good.

Too bad it will be removed though, formating the VB code works ok and I don't think auto formatting html is that big a deal (to program).

By the way the settings are not saved if you have a project open. For the project the settings stick but opening a new instance of vb and opening another project the settings come back.

tools -> options -> Text Editor -> HTML/XML - > format -> unchecked &quot;When saving document&quot; and &quot;When switching from design to HTML/XML view&quot;



Greetings, Harm Meijer
 
I think that it's only the HTML auto-formatter that is getting changed. I don't mind it too much, either, but I have run into instances where, for example, the auto-formatter yanked my control out of the form tags, thus breaking the code.
 
Check out this link for Visual Studio 2002.

Data Loss Fix for Visual Studio .NET
A problem has been discovered in Visual Studio .NET that can cause data to be lost while switching views. Download the fix.

Issue Description
Visual Studio .NET contains a problem that can result in a loss of data when switching views in the WebForms designer.

Microsoft has corrected this issue with a downloadable patch. All customers who use Visual Studio .NET should download and apply this update.

Symptoms
When switching views in the WebForm designer, code or controls can disappear.




Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top