Quantcast
Channel: AjaxControlToolkit Work Item Rss Feed
Viewing all articles
Browse latest Browse all 4356

Commented Issue: AsyncFileUpload and UpdatePanels [25475]

$
0
0
2 problems here with UpdatePanels
first is that it's impossible to cause a postback from the UploadedComplete (whats up with that name?) handler. I've been able to hack the AsyncFileUpload to do an UpdatePanel postback by using a hidden button and triggering the click event to cause the postback. But when the UpdatePanel refreshes, the AsyncFileUpload control is broken (either invisible or something like "32442--------image/jpg")

second is that if you have an upload in progress, and someone clicks a button to cause a partial postback, the client is nice enough to wait for the upload to complete, but the AFU is replaced by the same string of meaningless text (as above). (replace the ScriptManager line below with a Timer.Sleep(2000) to see this behavior) If the user dosn't cause a postback durring upload, the UpdatePanel and AFU seem to refresh and continue to function as they should.

codebehind:
protected void AsyncFileUpload1_UploadedComplete(object sender, AsyncFileUploadEventArgs e) {
//For Auto-Postback
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "reply", "top.$get(\"" + btnUploadComplete.ClientID + "\").click();", true);
//here's an upload delay
System.Threading.Thread.Sleep(2000);
}

protected void btnUploadComplete_Click(object sender, EventArgs e) {
lbl.Text = "File Recieved: " + AsyncFileUpload1.FileName;
}

and the HTML
<asp:UpdatePanel runat="server" ID="updatePanel" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnUploadComplete" EventName="Click" />
</Triggers>
<ContentTemplate>
<ajaxToolkit:AsyncFileUpload ID="AsyncFileUpload1" runat="server"
OnUploadedComplete="AsyncFileUpload1_UploadedComplete" ThrobberID="throbber"/>
<asp:Image runat="server" ID="throbber" ImageUrl="~/images/throbber.1.gif" />
<asp:Button runat="server" ID="btnUploadComplete" Text="Done Uploading" OnClick="btnUploadComplete_Click" />
<asp:Label runat="server" ID="lbl" />
</ContentTemplate>
</asp:UpdatePanel>
<ajaxToolkit:AsyncFileUpload ID="AsyncFileUpload2" runat="server" style="display:none;"/>
Comments: We were unable to reproduce this issue with the latest version of the AJAX Control Toolkit. Would you provide a sample project that uses AJAX Control Toolkit v15.1?

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>