View Single Post
  #1 (permalink)  
Old October 28th, 2009, 12:52 AM
rodmcleay rodmcleay is offline
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Question Hiding FileUpload Control

Hi All,
for cosmetic reaons I need to hide the file upload control and just expose an image button.
This all seems fine, I have the image button that is firing the file upload control and the user can select the file.

Howver when a different button is clicked to submit the form the Fileupload box clears before the page posts back.
Correction: The file doesn't post back, it clears the file upload control and gives it focus, I have to press the submit button again to post back, but the file has gone by then.

If I dont use the image button to load hte fileupload and show use the regular Browse button, the form submit button works correctly.

Why would an asp:imagebutton clear the fileupload control?
It should it even know it is there?

Any assistance would be greatly appreciated.



OnClientClick="triggerFileUpload();return false;"
function triggerFileUpload() {
document.getElementById('<%= FileUpload1.ClientID.ToString() %>').click();
"They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad."

Last edited by rodmcleay; October 28th, 2009 at 02:16 AM..