隐藏/显示的AsyncFileUpload控制不火服务器端UploadedComplete事件 [英] Hidden/Shown AsyncFileUpload Control Doesn't Fire Server-Side UploadedComplete Event
问题描述
我最近遇到的ASP.Net Ajax控件工具包的最新版本(3.0.40412)发布AsyncFileUpload控制来了。似乎有一个隐藏的控制程序是否使用它的时候透露,如&LT是一个问题; DIV>在
。的visible = false
标记
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
.
示例:
页code -
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="act" %>
.
.
.
<act:ToolkitScriptManager runat="server" ID="ScriptManager1" />
<asp:UpdatePanel runat="server" 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>
服务器端code -
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
我对UploadedComplete事件断点但它永远不会触发。但是,如果你把AsyncFileUpload控制输出的&LT; DIV&GT;
,使得它在初始页面可见呈现,控制工程如预期。
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.
所以,这是AsynchUploadControl中的一个bug,还是我没有把握的一个基本概念(这经常发生)?
So, is this a bug within the AsynchUploadControl, or am I not grasping a fundamental concept (which happens regularly)?
推荐答案
首先,确保你的标签具有以下attribuytes - ENCTYPE =的multipart / form-data的方法=后第二,你必须有一个可见的DIV内一种无形的DIV AsyncFileUpload。看到这两个线程。
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
这篇关于隐藏/显示的AsyncFileUpload控制不火服务器端UploadedComplete事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!