Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Professionals
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 5th, 2009, 09:51 PM
Friend of Wrox
Join Date: Dec 2008
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
Default fileupload control - disable input

I use a fileupload control on one of my asp.net page. It turned out that fileupload behaves differently with IE and Firefox:
  1. IE allows one to enter path and file name through the textbox (part of the fileupload), but
  2. Firefox only allows one to select file through through file dialog and the textbox is disabled/readonly.
I actually like Firefox behavior better, saving some error checking. The question is how to make IE behave the same way... I can easily add event handler through javascript to handle this, make keypress etc always return false. But... is there a simpler way, for example through some sort of property setting...

Also, with Firefox, when one clicks the textbox area, it automatically brings up the file dialog. Can I do this with IE?? (haven't actually tried, but while I am typing... this came to my mind: maybe I can trigger the click even of the upload button, when one clicks inside the textbox...)

If you have any experience with this, please share...

Last edited by PeterPeiGuo; January 5th, 2009 at 09:53 PM..
Old January 6th, 2009, 07:01 PM
Friend of Wrox
Join Date: Dec 2008
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts

Try the idea I wrote in the oringinal post, and added javascript to handle both onkeypress and onkeydown events. Worked perfectly.

What I couldn't do is: with Firefox, if you click on the textbox area, it also brings up the file dialog, I would like IE to mimic that. I tried two things, none worked:
  1. added onclick event handler, that does not nothing, I guess IE only treat a click on the browse button as a true click for the uploader, but not if you click the textbox area;
  2. added onfocus event handler, that worked... however the onfocus can easily be triigered when I didn't expect - didn't like that.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Access denied error when using FileUpload Control mii2029 ASP.NET 3.5 Basics 0 October 25th, 2008 05:45 PM
Problem to implement CSSClas on fileupload control azizur123 ASP.NET 2.0 Professional 1 October 13th, 2008 09:50 AM
FileUpload control aliirfan84 ASP.NET 2.0 Professional 1 June 2nd, 2007 03:37 PM
FileUpload Control MunishBhatia ASP.NET 2.0 Basics 2 December 6th, 2006 04:03 AM
FileUpload control -- file size detection ekwong ASP.NET 2.0 Basics 3 November 7th, 2006 06:32 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.