AjaxFileUpload doesn't fire OnUploadComplete Event

sciencechick

New Member
i am trying to get that \[code\]AjaxFileUpload\[/code\]-Control(used in ContentPage) working. But it does not fire \[code\]OnUploadComplete\[/code\] Event at server sideI am using version \[code\]4.1.60919.0\[/code\] of the ControlToolkit. I have tried everything i found on the internet. Here just a few steps:
  • Added enctype="multipart/form-data" method="post" to the form-element in my MasterPage
  • Nested the AjaxFileUpload into an UpdatePanel with UpdateMode=Always
  • Tried events UploadedComplete and OnUploadComplete, but stayed at the second one
  • Added a try-catch-block in the EventHandler to catch unknown exceptions and print the ExceptionMessage to a label on the site --> nothing happened
  • Tried it with(out) a ThrobberImage...
  • Many other tipps that did not work...
So, i hope we will find a solution together in this community. Heres my markup:\[code\]<%@ Page Title="New Download" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="NewDownload.aspx.cs" Inherits="Internals_NewDownload" %>\[/code\]\[code\]<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server"><ajax:ToolkitScriptManager ID="ToolkitscriptManager" runat="server"> </ajax:ToolkitScriptManager><h1>Create a new Download</h1> <ajax:AjaxFileUpload ID="FileUpload" runat="server" ThrobberID="ThrobberLabel" OnUploadComplete="FileUpload_UploadComplete" /> <asp:Label ID="ThrobberLabel" runat="server" Style="display: none;"><img alt="UploadingPicture" title="Please wait while uploading..." src='http://stackoverflow.com/questions/14500659/<%= Constants.DomainString +"/Data/Images/loading-small.gif" %>' /></asp:Label> <asp:Label ID="DownloadLabel" runat="server"></asp:Label></asp:Content>\[/code\]And this is my CodeBehind:\[code\]using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;public partial class Internals_NewDownload : System.Web.UI.Page{private string m_LanguageCode;protected void Page_Load(object sender, EventArgs e){ if (RouteData.Values.ContainsKey("LanguageCode")) m_LanguageCode = RouteData.Values["LanguageCode"].ToString(); //if (IsPostBack) // return; if (!User.IsInRole("Administrator") && !User.IsInRole("Kunde") && !User.IsInRole("Mitarbeiter")) Response.Redirect(Constants.DomainString + "/PermissionDenied.aspx"); Session[Constants.NonGlobalizedString] = true; Session[Constants.MenuInfoSession] = new ClsMenuInfo("NewDownload");}protected void FileUpload_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e){ try { string filePath = "~/upload/" + e.FileName; DownloadLabel.Text = filePath; } catch (Exception ex) { DownloadLabel.Text = ex.Message; }}}\[/code\]Please, if you have ANY idea, do not hesitate to let me know it. I am very confused as i think that i just did in that howtos i found on the internet...Thanks in advance!
 
Back
Top