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.
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" />
In both cases, the ASP.NET code is:
<asp:textbox id="ShortDescription" runat="server"
CssClass="content" Width="800px" MaxLength="100"> </asp:textbox>
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.
I would appreciate any help!
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" />
Apply the min-width property.
In Your CSS Style Sheet
.Textbox
{
min-width:100%;
}
In Your *.aspx
<asp:TextBox CssClass="TextboxStyle" placeholder="Enter the Title" runat="server" ID="TextBox1"></asp:TextBox>
This will update your text box
In the past I've found that setting the width through your class itself, instead of using the width property of the textbox will make sure the control is rendered properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With