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>

你可能感兴趣的:(upload)