RadUpload 怎么在Updatapanel下正常使用

RadUpload cannot upload files using AJAX calls. This is a limitation of the XmlHttpRequest component, used in all AJAX frameworks for asynchronous calls to the application. In order to upload a file you should perform a full page postback.

If you have automatically AJAX-enabled button or other control, which normally does postbacks, placed in UpdatePanel, RadAjaxPanel, RadGrid you could use one of the following workarounds to make the button to perform postbacks again.

Workaround for ASP.NET AJAX

You need to create a PostBackTrigger for the button which should initiate postback.

<asp:updatepanel runat="server" id="UpdatePanel1">
  <contenttemplate>
    <radu:radupload runat="server" id="RadUpload1" />
    <asp:button runat="server" id="Button1" text="Postback" />
  </contenttemplate>
  <triggers>
    <asp:postbacktrigger controlid="Button1" />
  </triggers>
</asp:updatepanel>

Workaround for RadAjaxPanel(这是RadControl的UpdatePanel)

Attach an event handler on the OnRequestStart client-side event of the RadAjaxPanel, which will disable the AJAX functionality if a specific button is clicked.

Note: The EventTarget property of the args parameter will contain the UniqueID of the clicked button.

<script type="text/javascript">
//on upload button click temporarily disables ajax to perform upload actions
function conditionalPostback(sender, args)
{
  if(args.EventTarget == "<%= ButtonSubmit.UniqueID %>")
  {
    args.EnableAjax = false;
  }
}
</script>
<rada:radajaxpanel runat="server" id="RadAjaxPanel1"
  clientevents-onrequeststart="conditionalPostback">
  <radu:radupload runat="server" id="RadUpload1" />
  <asp:button id="ButtonSubmit" runat="server" text="Upload" />
</rada:radajaxpanel>

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值