Fire Hand
Fire Hand

Reputation: 26346

Calling browse file window of fileupload control

I have an ImageButton and a FileUpload controls in a child page of a master page. I would like to achieve something like when user click on the ImageButton, the browse file window will pop-up like what we did when we click on the Browse button of the FileUpload control.

How can call the browse file window of the FileUpload control when i click on the ImageButton?

Upvotes: 2

Views: 7541

Answers (1)

y34h
y34h

Reputation: 1659

have you tried this?

<script>
function browse() {
    document.getElementById('<%= FileUpload1.ClientID %>').click();
}
</script>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:ImageButton ID="ImageButton1" runat="server" OnClientClick="browse()"
    ImageUrl="http://stackoverflow.com/favicon.ico" />

Upvotes: 2

Related Questions