Text box widths

L

Linda Wienholt

I have two separate user controls on the home page of a website. Both controls include a textbox. The textboxes have a width specified but the text box is intermitently being shown at a much larger width. Both controls always display the textboxes at the same width either correct or too large. The same user controls are also used on other pages in the website but the problem is only occuring on the home page.

I have not been able to establish a pattern and the only difference between the home page and other pages in the site is the inclusion of a third user control which is displaying correctly

I would appreciate any help

Thanks
 
A

Alessandro Zifiglio

hi Linda,
Can you look into the source code as the page is rendered and verify if the
textboxes render with the width you have specified. This is the easiest way
to check and see what is going wrong. Look at the source of your page for
the home page and the other pages where it is working. Then see if the
rendered input elements match. If your still having trouble solving this
post back with the code rendered in both cases.

Linda Wienholt said:
I have two separate user controls on the home page of a website. Both
controls include a textbox. The textboxes have a width specified but the
text box is intermitently being shown at a much larger width. Both controls
always display the textboxes at the same width either correct or too large.
The same user controls are also used on other pages in the website but the
problem is only occuring on the home page.
I have not been able to establish a pattern and the only difference
between the home page and other pages in the site is the inclusion of a
third user control which is displaying correctly.
 
L

Linda Wienholt

Hi

When the page is displayed correctly the html that is sent to the browser looks like this

<input name="Header2:txtKeyword" type="text" id="Header2_txtKeyword" style="width:80px;" /

and when it renders incorrectly it looks like this

<input name="Header2:txtKeyword" type="text" id="Header2_txtKeyword" /

In both cases the ASP.NET code is

<asp:TextBox ID="txtKeyword" Runat="server" Width="80"></asp:TextBox

I am not sure why the style tag is getting dropped. The above pages were both viewed in the same browser on the same computer.
 
A

Alessandro Zifiglio

Linda,

What browser are you using to view your pages. If you are using a browser
other than IE, the style properties will be dropped. This is because of how
asp.net provides multi-browser support. It has an an UpLevel or DownLevel
classification. UpLevel browsers are defined as Internet Explorer 5.5 and
greater. DownLevel browsers are defined as Internet Explorer 5.01 and
earlier, or browsers other than Internet Explorer.

You will note this behavior when setting style properties for your textbox
control and then previewing it in a browser other than IE --that is css
styling is dropped.

Only workaround i can think of is using the cssClass property and defining
your syling in this class. Also you said that in one page it works and on
another page within the same application its not working which gets me
thinking you are actually using IE however I havent been able to replicate
this behavior. On an IE browser the style properties work for me, even when
the control is included within a userControl, so my suggestion would be to
use the cssClass name property wheres to defining styles in your textbox
which will be included as inline css ;P


Browsers and client devices that are considered uplevel usually support at
least the following:

ECMAScript (JScript, JavaScript) version 1.2.
HTML version 4.0
The Microsoft Document Object Model (MSDOM)
Cascading style sheets (CSS)

Downlevel browsers and client devices support the following only:

HTML version 3.2

As you will note, any browser that is not IE will have downLevel
classification


Linda Wienholt said:
Hi,

When the page is displayed correctly the html that is sent to the browser looks like this:

<input name="Header2:txtKeyword" type="text" id="Header2_txtKeyword" style="width:80px;" />

and when it renders incorrectly it looks like this:

<input name="Header2:txtKeyword" type="text" id="Header2_txtKeyword" />

In both cases the ASP.NET code is:

<asp:TextBox ID="txtKeyword" Runat="server" Width="80"></asp:TextBox>

I am not sure why the style tag is getting dropped. The above pages were
both viewed in the same browser on the same computer.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top