We have purchased the control and are using it for the first time, so please excuse or possible ignorance.
We have an ascx like this:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TestAjax.ascx.cs" Inherits="TestAjax" %>
<MagicAjax:AjaxPanel runat="server" ID="MagicAjax1" AjaxCallConnection="Asynchronous">
<asp:Button runat="server" ID="UploaderInsertButton" Text="Upload file" />
<asp:Panel runat="server" ID="UploaderProgressPanel">
<asp:Label ID="UploaderProgressTextLabel" runat="server" />
</asp:Panel>
<CuteWebUI:Uploader runat="server" ID="Uploader1" InsertButtonID='UploaderInsertButton'
ProgressCtrlID='UploaderProgressPanel' ProgressTextID='UploaderProgressTextLabel'
OnFileUploaded="Uploader1_FileUploaded">
</CuteWebUI:Uploader>
</MagicAjax:AjaxPanel>
and a code behind like this:
public partial class TestAjax : UserControl
{
protected void Uploader1_FileUploaded(object sender, UploaderEventArgs file)
{
// Safe uploaded file
string targetFileName = String.Format("{0}/{1}", Constants.FilePathUpload, file.FileName);
file.CopyTo(Path.Combine(Constants.FilePathUpload, targetFileName));
}
}
Now, if we upload a file, OnFileUploaded fires - fine.
If we upload a second file, OnFileUploaded fires twice, for the first as well as the second file.
Uploading a third file makes it fire three times.
Is there a way to keep things simple? I'd love the control to raise the event only once for each upload (and not even after POSTing the site, only in Ajax mode).
Thanks very much in advance
Olaf