Firefox Compatibility with dynamically added labels?

G

Guest

Hi,

I add label and text box fields dynamically in code using C# and ASP.NET. I
set the width of the label using:

Label label = new Label();
label.Width = 20;
label.Text = "Test";
panel.Controls.Add(label);

This works fine with IE where the width is correct, but the widths of the
labels are not working using Mozilla Firefox. On further investigation it
seems that firefox is having problems with the <span> tag that is used on the
aspx page.

Has anyone come across this or know or a work around.
 
M

Michel de Becdelièvre

first possibility : is firefox identified as an uplevel browser in your
setup ?

if not, you need to change this
(by overriding in web.config :
<browserCaps>
<file src="Web.browserCaps.xml" />
</browserCaps>
) with a suitable Web.browserCaps.xml, a number of them are available on the
web, do a search.

otherwise all Controls (except explicit HtmlControls) will output HTML3.2
junk.

second possibility :
IE is dead wrong in its HTML W3C conformity. This is fairly common.

A good way to avoid being trapped in this kind of situation is to use
HtmlControls rather than Controls unless they have some *real* added value
(such as Repeater, DataGrid, HierarGrid, etc.). This way you "think" HTML
first, IE second.
 
M

Michel de Becdelièvre

False.

To have firefox recognized (in 1.1), you need to change your config files.
(Not that this is very usefull because of the liberal use of document.all[]
in ASP.Net JavaScript files).
 

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

Top