C# FileUpload 控件配合 Ajax 时特殊写法

Need to create a PostBackTrigger for the button that initiates postback like as follows. 

          <asp:ScriptManager ID="ScriptManager1" runat="server">
          </asp:ScriptManager>
          <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="True">
              <Triggers>
                 <asp:PostBackTrigger ControlID="Button1" />
             </Triggers>

             <ContentTemplate>
                  <asp:FileUpload ID="FileUpload1" runat="server" />
                  <asp:Button ID="Button1" runat="server" Text="  上传  " OnClick="Button1_Click" />
                  ......
             </ContentTemplate>
          </asp:UpdatePanel>

经验:虽然能让FileUpload在Ajax中正常使用,但这种写法页面会刷新。

参考资料:http://www.c-sharpcorner.com/uploadfile/prathore/fileupload-control-in-update-panel-using-Asp-Net-ajax/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值