不刷新动态添加FileUpload
页面
    <tr>
        <td align="right" style="height: 48px">
            <asp:Label ID="Label8" runat="server" Text="附  件:" Width="100%"></asp:Label></td>
        <td align="left" colspan="3" style="height: 48px">
        <div id="MyFile" style="width:100%">
            <asp:FileUpload ID="FileUpload1" runat="server" Width="80%" />       
            </div>
            <input id="btn_AddFile" type="button" runat="server" value="添加附件" />
        </td>
    </tr>.cs中
 protected void Page_Load(object sender, EventArgs e)
    {
        //注册添加文件脚本
        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript",
        "function addFile(btn)" +
        "{ var str = '<br><INPUT type="file" style="width:80%" NAME="File">'; " +
        " document.getElementById('MyFile').insertAdjacentHTML("beforeEnd",str); " +
        " btn.value='继续添加附件'" +
       "}", true);
        btn_AddFile.Attributes.Add("onClick", "addFile(this)");
}
                    
                

    
                
            
        
浙公网安备 33010602011771号