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.