文本框宽度的问题 - ASP.NET [英] Textbox Width Problems - ASP.NET

查看:93
本文介绍了文本框宽度的问题 - ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,生成一个文本框的页面上的用户控件。文本框具有指定的宽度,但在比code为指定小得多宽度intermitently正在显示的文本框。我问用户发送我复制查看源文件的输出,这样我可以比较好的和坏的结果。所谓间歇性,我的意思是类似的构建 - 不同的计算机上。请注意,坏的结果始终显示在相同的坏计算机(有这个问题一个以上的用户),反之,在好的计算机(所有具有相同版本的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 code是:

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.

我想AP preciate任何帮助!

I would appreciate any help!

推荐答案

尝试与CssClass属性设置文本框,或作为一种风格属性参数,而不是使用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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆