Prevent VS from changing my code

  • Thread starter Thread starter Chris Mahoney
  • Start date Start date
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
 
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
 
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
 
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
 
Chris said:
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
Have you updated the browserCaps section of machine.config - I used to
get nasty/bad rendering in Opera, because the default browserCaps
didn't recognise it properly, and I believe Firefox is similarly
affected.

Unfortunately, Microsoft chose a company (cyScape) to do the updating
of this file who then promptly didn't provide any updates. Several
people have gone to the effort of performing updates however. I use the
one from http://slingfive.com/pages/code/browserCaps/

HTH,

Damien
 
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

Back
Top