troubleshooting Question

Asp.net - One Button File Upload

Avatar of tuchfeld
tuchfeld asked on
ASP.NET
3 Comments2 Solutions814 ViewsLast Modified:
Hello,
currently I have these two elements, and it works fine:
<asp:FileUpload id="fileUpload" style="" runat="server" />
<asp:Button ID="upload_Button" runat="server" Text="Upload"></asp:Button>
The code-behind looks like:
Private Sub upload_Button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles upload_Button.Click
	'...
	fileUpload.FileName
	'...
End Sub
See screenshot:
Two buttons file uploadI'd like to have only one button.
I've tried to do that (suposing I can hide the visibility of FileUpload element):
<asp:Button ID="upload_Button" runat="server" Text="Upload" OnClientClick="document.getElementById('fileUpload').click();"></asp:Button>
But after selecting the Local file it didn't call Sub upload_Button_Click.
What should be done to accomplish that task?
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros