473,513 Members | 2,605 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# FileUpload width property not working in FF

36 New Member
While using the FileUpload control in firefox the width property is not set.

<asp:FileUpload ID="dd" runat="server" width="300px" />

In firefox the control is rendered as following
<input type="file" name="ctl00$ContentPlaceHolder1$dd" id="ctl00_ContentPlaceHolder1_dd" style="width:300px;" />

Anyone know why width is ignored here?

(works in IE7)
Aug 8 '07 #1
5 8906
drhowarddrfine
7,435 Recognized Expert Expert
<input> is an inline element, hence it should not be styleable with width. IE, as usual, is not performing correctly by allowing what you have. You can try using 'display:block' on the form or input tag, can't remember, but I don't recall if that works. You may have to use the 'size' attribute.
Aug 8 '07 #2
Frinavale
9,735 Recognized Expert Moderator Expert
<input> is an inline element, hence it should not be styleable with width. IE, as usual, is not performing correctly by allowing what you have. You can try using 'display:block' on the form or input tag, can't remember, but I don't recall if that works. You may have to use the 'size' attribute.
DrHowardDrFine is correct about the <input> element.
According to the w3c website on the Html Input Tag, there is no "width" attribute for the input tag. However, there is a "size" attribute.

Maybe try setting the size attribute as he has suggested.

What doesn't quite make sense to me is that I can set the width of my text box using css.

Eg. The following code works fine in IE and FireFox...it will draw a TextBox 50px wide.......
Expand|Select|Wrap|Line Numbers
  1. <input name="myTextBox" type="text" style="width:50px;" />
  2.  
Anyone care to explain why this happens?
I've been looking it up for a little while now but I'm still confused.

Have you tried setting the width of the UploadControl using css?

-Frinny
Aug 8 '07 #3
drhowarddrfine
7,435 Recognized Expert Expert
User agent conformance.
CSS 2.1 does not define which properties apply to form controls and frames, or how CSS can be used to style them. User agents may apply CSS properties to these elements. Authors are recommended to treat such support as experimental. A future level of CSS may specify this further.
Aug 8 '07 #4
Frinavale
9,735 Recognized Expert Moderator Expert
User agent conformance.
That explains it!
Thanks a lot for the information!

:)

-Frinny
Aug 8 '07 #5
ka3m0n
1 New Member
********Solution ************
use "Size". It's not a property of the control but it's an attribute of a text input control. (Works for FF & IE)

<asp:FileUpload ID="upImage" runat="server" Size="50" />
Sep 28 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
3495
by: Knoxy | last post by:
Hey all, I hope someone can help me on this one as it's driving me nuts. Basically i have the asp:fileupload control embedded on my page but, hasfile 'always' returns false. I have tried using...
3
9593
by: yeltsin27 | last post by:
Theming seems only to affect the text box of a FileUpload control, not the Browse button. Is there any way to theme the button as well? Thanks, ChrisN
12
15626
by: Phil Z. | last post by:
After migrating an ASP.NET 1.1 application to 2.0 we were getting "Cannot access a closed file" errors when uploading. I found a number of post on the subject and have since moved from using an...
0
1556
by: =?Utf-8?B?TGVvbkc=?= | last post by:
I'm trying to upload a file using an asp:FileUpload control and an asp:LinkButton. This works fine, while there is an actual filepath in the fileupload upload control. Even an empty field works....
5
12075
by: =?Utf-8?B?QmVydA==?= | last post by:
Hi How can you set the filename property in the asp:fileupload control? How can you persist the value of the chosen filename between postbacks? thanks B
5
2756
by: =?Utf-8?B?VEQgaXMgUFNQ?= | last post by:
I have a FileUpload control within a FormView (although I tried it outside the FormView and got the same result) in the InsertTemplate. When the <Insertbutton is clicked and the Insert Command is...
6
2079
by: GaryDean | last post by:
Is there any way to make an asp FileUpload control work within an UpdatePanel? Thanks, Garyh
0
1089
by: pauld | last post by:
Hello- Note: this is all VB/Asp.net 2.0 I have a formview(insert template) whose fields are bound to a datagrid that is connects to an MS SQL Server 2005 database. One of the options on the...
2
5975
by: =?Utf-8?B?UGF1bA==?= | last post by:
I have a gridview with 2 columns. One column is a BoundColumn to a part number (string). One column is an ItemTemplate with a FileUpload control. There can be multiple rows (i.e. part numbers)...
0
7160
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7537
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7099
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5086
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3233
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.