When I have multiples AjaxFileUpload controls on the same page, the event fired is always the same.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server"
onuploadcomplete="AjaxFileUpload1_UploadComplete" AllowedFileTypes=""
ContextKeys="1" MaximumNumberOfFiles="0" />
<asp:AjaxFileUpload ID="AjaxFileUpload2" runat="server"
MaximumNumberOfFiles="0" OnUploadComplete="AjaxFileUpload2_UploadComplete"
ContextKeys="2" />
<asp:AjaxFileUpload ID="AjaxFileUpload3" runat="server"
MaximumNumberOfFiles="0" OnUploadComplete="AjaxFileUpload3_UploadComplete"
ClientIDMode="AutoID" ContextKeys="3" />
</form>
</body>
</html>
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AjaxControlToolkit;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
//Only this event is fired, and allways with id=AjaxFileUpload1 and ContextKeys=1
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
AjaxFileUpload aj = sender as AjaxFileUpload;
string id = aj.ID;
string ContextKeys = aj.ContextKeys;
}
protected void AjaxFileUpload3_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
}
protected void AjaxFileUpload2_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
}
}
Comments: here there is a fix proposal: http://stackoverflow.com/questions/10760895/ajax-toolkit-file-upload-is-not-called
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server"
onuploadcomplete="AjaxFileUpload1_UploadComplete" AllowedFileTypes=""
ContextKeys="1" MaximumNumberOfFiles="0" />
<asp:AjaxFileUpload ID="AjaxFileUpload2" runat="server"
MaximumNumberOfFiles="0" OnUploadComplete="AjaxFileUpload2_UploadComplete"
ContextKeys="2" />
<asp:AjaxFileUpload ID="AjaxFileUpload3" runat="server"
MaximumNumberOfFiles="0" OnUploadComplete="AjaxFileUpload3_UploadComplete"
ClientIDMode="AutoID" ContextKeys="3" />
</form>
</body>
</html>
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AjaxControlToolkit;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
//Only this event is fired, and allways with id=AjaxFileUpload1 and ContextKeys=1
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
AjaxFileUpload aj = sender as AjaxFileUpload;
string id = aj.ID;
string ContextKeys = aj.ContextKeys;
}
protected void AjaxFileUpload3_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
}
protected void AjaxFileUpload2_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
}
}
Comments: here there is a fix proposal: http://stackoverflow.com/questions/10760895/ajax-toolkit-file-upload-is-not-called