开发者

Hidden/Shown AsyncFileUpload Control Doesn't Fire Server-Side UploadedComplete Event

I recently came across the AsyncFileUpload control in the latest (3.0.40412) release of the ASP.Net Ajax Control Toolkit. There appears to be an issue when using it in a hidden control that is later revealed, such as a <div> tag with visible=false.

Example:

Page code -

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="act" %>
.
.
.
<act:ToolkitScriptManager runat="server" ID="ScriptManager1" />
<asp:UpdatePanel runat="ser开发者_JS百科ver" ID="upnlFileUpload">
    <ContentTemplate>
        <asp:Button runat="server" ID="btnShowUpload" Text="Show Upload" />
        <div runat="server" id="divUpload" visible="false">
            <act:AsyncFileUpload runat="server" id="ctlFileUpload" />
        </div>
    </ContentTemplate>
</asp:UpdatePanel>

Server-side Code -

Protected Sub ctlFileUpload_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles ctlFileUpload.UploadedComplete

End Sub

Protected Sub btnShowUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnShowUpload.Click
    divUpload.Visible = True
End Sub

I have a breakpoint on the UploadedComplete event but it never fires. However, if you take the AsyncFileUpload control out of the <div>, making it visible at initial page render, the control works as expected.

So, is this a bug within the AsynchUploadControl, or am I not grasping a fundamental concept (which happens regularly)?


First, make sure your tag has the following attribuytes - enctype="multipart/form-data" method="post" Secondly, you have to have the AsyncFileUpload in an invisible DIV within a visible DIV. See these two threads on it.

http://forums.asp.net/t/1489399.aspx

http://forums.asp.net/t/1479689.aspx?PageIndex=2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜