Home All Groups Group Topic Archive Search About

Textbox Width Issue (Rendered differently for different browsers)

Author
17 Dec 2005 10:37 AM
Jeff
Using ASP.NET 1.1

I have an <asp:TextBox... for which I set the width property --- "width=30".

The textbox is being rendered to the browser like this:

<input name="someName" type="text" maxlength="3" id="someID"
style="width:30px;" />

Notice the [Width=30] gets rendered as [style="width:30px;"]. This causes
the textbox to be 30 pixels wide, at least in IE and Opera.

I have discovered in testing that the [style="width:30px;"] part is *omitted
completely* from the rendered HTML when the page is requested by FireFox or
Netscape Navigator (6.2) - so the textbox (really <input... />) gets some
default width rather than being set to 30 pixels wide.

What can I do to set the width the same for FireFox and NN (same as for IE)?

Thanks!

Author
17 Dec 2005 12:16 PM
Showjumper
Dont use inline styles. Rather use the cssclass property and set it to a
class defined in your stylesheet. The problem w/ the inline styles is  that
asp.net see gecko browser as downlevel and as such doesnt send the inline
style info. And i would have thought that it woulndt send it to opera either
since it considers only ie as uplevel.
Show quote
"Jeff" <Jeff@NoSpam.com> wrote in message
news:OXdpRXvAGHA.2040@TK2MSFTNGP14.phx.gbl...
>
> Using ASP.NET 1.1
>
> I have an <asp:TextBox... for which I set the width property --- 
> "width=30".
>
> The textbox is being rendered to the browser like this:
>
> <input name="someName" type="text" maxlength="3" id="someID"
> style="width:30px;" />
>
> Notice the [Width=30] gets rendered as [style="width:30px;"]. This causes
> the textbox to be 30 pixels wide, at least in IE and Opera.
>
> I have discovered in testing that the [style="width:30px;"] part is
> *omitted completely* from the rendered HTML when the page is requested by
> FireFox or Netscape Navigator (6.2) - so the textbox (really <input... />)
> gets some default width rather than being set to 30 pixels wide.
>
> What can I do to set the width the same for FireFox and NN (same as for
> IE)?
>
> Thanks!
>
>
Author
17 Dec 2005 4:56 PM
Eirik
Take a look at the following URL for an Browsercap update too add to your
web.config or machine.config file.
http://slingfive.com/pages/code/browserCaps/

That should take care of that problem with asp.net considering most browsers
as downlevel.

Regards

AddThis Social Bookmark Button