Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

FileUpload control not rending properly in Firefox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
James Page - 04 Sep 2007 18:24 GMT
Has anyone found a way to ensure that the file upload control renders the
same in IE 7 and Firefox 2. In particular the width attribute.

This renders ok in IE7 but not in Firefox 2.0 (width set to 600px):

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb"
Inherits="AJAXEnabledWebApplication1._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
   <title>Untitled Page</title>
</head>
<body>
   <form id="form1" runat="server">
   <div>
       <asp:FileUpload ID="FileUpload1" runat="server" Width="600px" /></div>
   </form>
</body>
</html>

I've tried using CSS to set the width of the control but the same result!

I've googled but the only thing i can find are references to asp 1.1 and
"browserCaps" which is of no use.

I'm using VS2005 VB.net & ASP.net 2.0

Any ideas?
Mark Rae [MVP] - 04 Sep 2007 18:28 GMT
> Any ideas?

When you do a View Source from both browsers, how does it compare...?

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

James Page - 04 Sep 2007 18:38 GMT
Both identical:

Firefox =

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
    Untitled Page
</title></head>
<body>
   <form name="form1" method="post" action="Default.aspx" id="form1"
enctype="multipart/form-data">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJLTcwNzkzOTQzD2QWAgIDDxYCHgdlbmN0eXBlBRNtdWx0aXBhcnQvZm9ybS1kYXRhZGQTiLHSoItd/ZcHLHDCAbxIdLMhWQ==" />
</div>

   <div>
       <input type="file" name="FileUpload1" id="FileUpload1"
style="width:600px;" /></div>

   </form>
</body>
</html>

IE7=

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
    Untitled Page
</title></head>
<body>
   <form name="form1" method="post" action="Default.aspx" id="form1"
enctype="multipart/form-data">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJLTcwNzkzOTQzD2QWAgIDDxYCHgdlbmN0eXBlBRNtdWx0aXBhcnQvZm9ybS1kYXRhZGQTiLHSoItd/ZcHLHDCAbxIdLMhWQ==" />
</div>

   <div>
       <input type="file" name="FileUpload1" id="FileUpload1"
style="width:600px;" /></div>
   </form>
</body>
</html>
Mark Rae [MVP] - 04 Sep 2007 20:27 GMT
> Both identical:

Wow! That's really strange - toggle between FireFox rendering and IE
rendering really is totally different.

If you want to see something even weirder, have a look at this in FireFox in
IE mode:

<div>
   <input type="file" name="FileUpload1" id="FileUpload1"
style="width:100px;" />
   <input type="text" name="txtText" id="txtTest" style="width:600px;" />
</div>

Now switch to FireFox mode...

Seems that Mozilla are adamant that this is the way it's supposed to be, and
that the file control *shouldn't* be resizeable with styles...

Nil desperandum...

http://www.quirksmode.org/dom/inputfile.html
http://www.google.co.uk/search?hl=en&rlz=1T4GGIH_en-GBGB220GB220&q=FireFox+input
+type%3D%22file%22+width&meta
=

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

James Page - 04 Sep 2007 22:00 GMT
Strange!

But there must be a way to set the width of FileUpload control in Firefox.

I can't believe that a browser that is used by millions won't render such a
widespread control. Whats going on?

Is this a bug with firefox or asp.net? Is there a work around??
Mark Rae [MVP] - 04 Sep 2007 22:04 GMT
> Is this a bug with firefox or asp.net? Is there a work around??

See my previous reply...

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

James Page - 05 Sep 2007 01:16 GMT
Sorry I didn't check out your links! Looks like a work around - thanks.

But why o why is such a simple thing so convoluted!!

Cheers
James
Mark Rae [MVP] - 05 Sep 2007 01:29 GMT
> Sorry I didn't check out your links! Looks like a work around - thanks.
>
> But why o why is such a simple thing so convoluted!!

<shrugs>

It's known in the trade as double-O double-T (= one of those things)

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.