我在生成文本框的网站页面上有一个用户控件.文本框具有指定的宽度,但文本框间歇性地以比代码中指定的宽度小得多的宽度显示.我要求用户向我发送查看源代码"输出的副本,以便我可以比较好的和坏的结果.通过间歇性",我的意思是类似的构建 - 不同的计算机.请注意,坏结果总是显示在相同的坏"计算机上(有不止一个用户遇到此问题),相反,好"计算机(都与坏"计算机使用相同版本的 IE7) 总是显示好"的结果.
I have a user control on a page of a website that generates a text box. The textbox has a width specified, but the text box is intermitently being shown at a much smaller width than is specified in the code. I asked the users to send me copies of the "view source" output so that I could compare good and bad results. By "intermittent", I mean similar builds - different computers. Please note that the bad results are ALWAYS displayed on the same "bad" computers (there is more than one user with this problem) and, conversely, the "good" computers (all with the same version of IE7 as the "bad" computers) always display "good" results.
页面正确显示后,发送到浏览器的html如下所示:
When the page is displayed correctly, the html that is sent to the browser looks like this:
<input name="ShortDescription" type="text" maxlength="100"
id="ShortDescription" class="content" style="width:800px;" />
当它渲染不正确时,它看起来像这样:
and when it renders incorrectly, it looks like this:
<input name="ShortDescription" type="text" maxlength="100"
id="ShortDescription" class="content" />
在这两种情况下,ASP.NET 代码都是:
In both cases, the ASP.NET code is:
<asp:textbox id="ShortDescription" runat="server"
CssClass="content" Width="800px" MaxLength="100"> </asp:textbox>
我不确定为什么样式标签会被删除.以上页面均在不同计算机上的同一浏览器(IE7)中查看.这些计算机具有公司版本,因此它们应该"配置相同.
I am not sure why the style tag is getting dropped. The above pages were both viewed in the same browser (IE7) on different computers. The computers have a corporate build so they "should" be configured the same.
我将不胜感激!
尝试在 CssClass 中设置 TextBox,或者作为样式属性参数而不是使用 Width 属性
Try setting the TextBox with in the CssClass, or as a style attribute parameter rather than using the Width attribute
<asp:TextBox id="ShortDescription" runat="server" CssClass="content" MaxLength="100" style="width: 800px" />
<style>.content { width: 800px }</style>
<asp:TextBox id="ShortDescription" runat="server" CssClass="content" MaxLength="100" />
这篇关于文本框宽度问题 - ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!