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:
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>

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?
ASP.NET

Avatar of undefined
Last Comment
tuchfeld

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Roopesh Reddy

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Kaushal Arora

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
tuchfeld

ASKER
Thx for your solution
I might use JQuery solution..
but if facebook use it.. who am I? :-)
facebook uploading dialog
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck