Saturday, 17 January 2009

Width of FileUpload control in Firefox

I'm using standard ASP.NET FileUpload control and had some troubles changing its width. For almost all browsers the regular width attribute does the job (as expected). However, for some strange reasons it is completely ignored by FF.

To change the width of FileUpload control in FF you have to use size attribute instead. Example:
<asp:FileUpload ... size="50" />
The units used by size attribute are characters. Remember to use both size (for FF) and width (for all other browsers) to make the change visible for all users. Sometimes it may be tricky to make this field have the same width on all browsers.

I'm not sure why Mozilla did it this way but I don't like it at all. Any Ideas?

I found solution here.

No comments: