Vb.net – Calling browse file window of fileupload control

asp.netvb.net

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?

Best Answer

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" />