Prevent VS from changing my code

C

Chris Mahoney

Hi

I'm using Studio 2003 and am getting frustrated with it changing my HTML.
For example, I can enter the following:

<asp:label id="myLabel" style="width: 100px" runat="server">

I change to design view then back to HTML view, I find that it's changed the
code:

<asp:label id="myLabel" width="100px" runat="server">

How can I stop it from doing this?

Thanks
Chris
 
D

Damien

Chris said:
Hi

I'm using Studio 2003 and am getting frustrated with it changing my HTML.
For example, I can enter the following:

<asp:label id="myLabel" style="width: 100px" runat="server">

I change to design view then back to HTML view, I find that it's changed the
code:

<asp:label id="myLabel" width="100px" runat="server">

How can I stop it from doing this?

Thanks
Chris

Tools -> Options -> Text Editor -> HTML/XML -> Format

Look at the "Apply Automatic Formatting" options.

Damien
 
C

Chris Mahoney

I turned them both off and it's still doing it. Any other ideas?

Thanks
Chris
 
D

Damien

Chris said:
I turned them both off and it's still doing it. Any other ideas?

Thanks
Chris
Your right. There doesn't seem to be any way to stop it. Why is it
important to you that it's set as a style rather than as the width
attribute? (If I remember correctly, when it's actually rendered it'll
be rendered using a style attribute rather than width anyway)

Damien
 
C

Chris Mahoney

The width attribute works correctly in IE, but the server seems to strip it
off if the user's running Firefox. Setting it as a style prevents this, so
it appears correctly in both browsers.

Chris
 
C

Chris Mahoney

Wow, thanks! I had no idea that there was a 2-minute fix available. This
will save me sooooo much time :)

Thanks again!

Chris
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top