ASP.NET Call JavaScript Function OnClick
<p>I have an asp.net page with a FileUpload control so that the user can browse to select a file.  I wanted to assign a default value so the user doesn't need to browse unless they're doing something out of the norm, but the File properties are read-only.</p>

<p>So I set the Visible property of the FileUpload control to false and put in a textbox and button.  In that textbox I put the default path I want.  When the user clicks the button I want it to open the Browse window that clicking the FileUpload control would.  I have this:</p>

<pre><code>&lt;head&gt;
    &lt;meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"/&gt;
&lt;meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE"/&gt;
&lt;meta content="JavaScript" name="vs_defaultClientScript"/&gt;
&lt;meta content="http://schemas.microsoft.com/intellisense/ie5"name="vs_targetSchema"/&gt;   

&lt;script src="common.js" type="text/javascript"&gt;&lt;/script&gt;

    &lt;script type="text/javascript"&gt;
        function fileBrowse()
        {
            document.getElementById('FileBrowse').click();
        }
    &lt;/script&gt;

&lt;/head&gt;
</code></pre>

<p>And then in the code I have this:</p>

<pre><code>Protected Overrides Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    MyBase.Page_Load(sender, e)

    Me.btnINI.Attributes.Add("onclick", "javascript:fileBrowse();")
End Sub
</code></pre>

<p>FileBrowse is the name of the FileUpload control on the page.  btnINI is the name of the button that I want to launch the browse.</p>

<p>When I click the button nothing happens - no errors, nothing is launched.  Any help would be much appreciated!</p>
