Prevent VS from changing my code

Discussion in 'ASP .Net' started by Chris Mahoney, Aug 19, 2005.

  1. 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 Mahoney, Aug 19, 2005
    #1
    1. Advertising

  2. Chris Mahoney

    Damien Guest

    Chris Mahoney wrote:
    > 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
     
    Damien, Aug 19, 2005
    #2
    1. Advertising

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

    Thanks
    Chris


    On 19/8/05 7:41 PM, in article
    , "Damien"
    <> wrote:

    > Chris Mahoney wrote:
    >> 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 Mahoney, Aug 19, 2005
    #3
  4. Chris Mahoney

    Damien Guest

    Chris Mahoney wrote:
    > 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
     
    Damien, Aug 19, 2005
    #4
  5. 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



    On 20/8/05 12:18 AM, in article
    , "Damien"
    <> wrote:

    > Chris Mahoney wrote:
    >> 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
    >
     
    Chris Mahoney, Aug 19, 2005
    #5
  6. Wow, thanks! I had no idea that there was a 2-minute fix available. This
    will save me sooooo much time :)

    Thanks again!

    Chris



    On 22/8/05 9:25 PM, in article
    , "Damien"
    <> wrote:

    >
    > Chris Mahoney wrote:
    >> 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
    >
     
    Chris Mahoney, Aug 23, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Winston
    Replies:
    5
    Views:
    673
    Eric Lawrence [MSFT]
    Feb 11, 2004
  2. Replies:
    9
    Views:
    4,530
  3. Replies:
    2
    Views:
    270
  4. JB
    Replies:
    1
    Views:
    359
    James Irvine
    Jun 11, 2010
  5. George Wang
    Replies:
    34
    Views:
    388
    George Wang
    Jun 3, 2008
Loading...

Share This Page