Link to home
Start Free TrialLog in
Avatar of tuchfeld
tuchfeld

asked on

Asp.net - One Button File Upload

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>

Open in new window

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

Open in new window

See screenshot:
User generated imageI'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>

Open in new window

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
Avatar of Roopesh Reddy
Roopesh Reddy
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tuchfeld
tuchfeld

ASKER

Thx for your solution
I might use JQuery solution..
but if facebook use it.. who am I? :-)
User generated image