ASP.NET FILEUPLOAD click事件

摘要:ASP.NET FILEUPLOAD click事件

FILEUPLOAD没有click事件,必須用javascript 去加,程式碼如下

 <asp:FileUpload ID="FileUpload1" runat="server"  />
    <p>
        <asp:Button ID="Button1" runat="server" Text="上傳" />
    </p>
 
 protected void Page_Load(object sender, EventArgs e)
        {
            FileUpload1.Attributes.Add("Onclick", "Button1.style.display='block';");
            Button1.Attributes.Add("style", "display:none;");
        }