locked
.Net or browser not interpreting width attributes of form controls RRS feed

  • Question

  • User865464427 posted

    In the last 24 hrs I've encountered a very strange problem which seems to be specific to my computer.

    Where I have a text box or similar asp.net control on a webpage, when I view the page in a browser (IE7 or firefox) the 'width="200px"' attribute is ignored and consequently all my elements are set to the default size of about 140px.

    If my colleague views my project from his computer (my machine acting as the server) and views source, those attributes appear as 'style="width:200px"' as expected. So its clearly something going wrong at my end. However I can't tell if its the .NET compiler or a browser issue, because if I view the live project from our production server I lose the width values there as well, and my colleague doesn't.

    We're both running IE7 on XP with automatic updates switched on, although thats not to say they're in sync.

    I don't understand what part of my machine is interpreting the <asp:textbox> tags if remote computers can render the content correctly from my machine and I can't?

    Wednesday, November 4, 2009 4:56 AM

Answers

  • User865464427 posted

    Oops I had the perfect screen shot for you until I performed a system restore back to last week which thankfully seems to have cured the problem.

    Basically if you used any .net webcontrol attribute that needed to render inside a "style" tag it just got ignored, but if you put a style tag in programatically using object.attribute.add("style", "width:200px") it would work, because it wasn't required to interpret anything, just render it.

    <asp:textbox runat="server" width="200px" backcolor="#0066ff" id="txtTest"/> would end up simply <input type="text" id="txtTest"/>

    Creating a normal form control with a style attribute would render correctly e.g <input type="text" id="test" style="border:1px solid red"/>

    I can only assume it was caused by my recently uninstalling Adobe Reader 7 and upgrading to Adobe Reader 9 because it was affecting all my browsers but no one elses computers had the problem, but I am still curious to know how that could happen because I thought IIS had to compile the aspx/ascx code to HTML before serving it to the client, so my machine must have been doing something strange after that bit, because my localhost was serving the correct HTML to everyone else just fine!

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 4, 2009 5:31 AM

All replies

  • User487807879 posted

    It would be interesting if you could post screenshots of the problem.

    Wednesday, November 4, 2009 5:11 AM
  • User865464427 posted

    Oops I had the perfect screen shot for you until I performed a system restore back to last week which thankfully seems to have cured the problem.

    Basically if you used any .net webcontrol attribute that needed to render inside a "style" tag it just got ignored, but if you put a style tag in programatically using object.attribute.add("style", "width:200px") it would work, because it wasn't required to interpret anything, just render it.

    <asp:textbox runat="server" width="200px" backcolor="#0066ff" id="txtTest"/> would end up simply <input type="text" id="txtTest"/>

    Creating a normal form control with a style attribute would render correctly e.g <input type="text" id="test" style="border:1px solid red"/>

    I can only assume it was caused by my recently uninstalling Adobe Reader 7 and upgrading to Adobe Reader 9 because it was affecting all my browsers but no one elses computers had the problem, but I am still curious to know how that could happen because I thought IIS had to compile the aspx/ascx code to HTML before serving it to the client, so my machine must have been doing something strange after that bit, because my localhost was serving the correct HTML to everyone else just fine!

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 4, 2009 5:31 AM
  • User1802045989 posted

    It looks to be your browser issue. As you said you can see the style attribute in view source with the correct width, so your IIS and .NET are doing fine. Did you install some softwares which install some browser ad-ons which might be interfering with its original behaviour.

    Try disabling all 3rd party browser toolbars/plugins/ad-ons and see if that works. 

    Friday, November 6, 2009 5:36 AM
  • User865464427 posted

    It turns out that it wasn't related to Adobe Reader, but a Windows Live Messenger update (which makes a lot more sense given the type of interference it was causing).

    I let Windows Live Messenger update selected components up to build 14.0.8089.726 first thing this morning and instantly the problem returned.

    I performed a system restore back to the previous day (Windows Live Messenger build 14.0.8064.206) and the problem went away.

    I'm surprised I haven't heard of more people having this issue, but maybe it was because I refused to let it install the full suite of useless apps I don't need that was causing something to go wrong. Anyway, hope this info helps someone! 

    Monday, November 9, 2009 4:34 AM