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

Commented Issue: Multiple AjaxFileUpload on same page fires allways the same event [27175]

$
0
0
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: You can try another solution to solve this problem now by using AscnFileUpload ([http://www.dotnettips4u.com/2013/02/asynchronous-file-uploading-using-ajax.html](http://http://www.dotnettips4u.com/2013/02/asynchronous-file-uploading-using-ajax.html)). While waiting author fix error for AjaxFileUpload. I tried and worked ! Hope author fix this bug soon.

Viewing all articles
Browse latest Browse all 4356

Trending Articles



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