This project has moved and is read-only. For the latest updates, please go here.

Catch AllFilesFinished Event

Aug 11, 2009 at 1:47 PM


First of all, congratulations for the Code. Its very nice and usual.

My problem is: I'm new to SilverLight, so I'm getting some problems to Catch the AllFilesFinished Event.
I've looked into all files provided in the project, and also in documentation page.
Not found my answers, cause in the TestePage.aspx you create the Object in other way.

My page:

<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Upload.aspx.vb" Inherits="Upload" %>
<%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls"
    TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
    <script type="text/javascript">

    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">

            <asp:Silverlight ID="Xaml1" runat="server" Enabled="false"  Visible="false"
            InitParameters="FileFilter=Imagens Jpeg (*.jpg)|*.jpg,CustomParam=1,DefaultColor=LightBlue" />


In fact, i cant really generate the JavaScript enough to reach the Event.
All ways i've tried not leaded me to the expected result.
Could you help me with this, writing, in this code above, how can i, for example, say a 'Hello World' when AllFilesFinished Event fires up?
Thank You!

Aug 11, 2009 at 1:50 PM

You can have a look at the JavascriptOnly_MultiFileUploadTestPage.html. It is included in the project and shows you exactly how to setup the JavaScript events.

Aug 11, 2009 at 3:29 PM

Absolut Fantastic...

I've faced another problem, but already solved.
For those who wants to pass a diferent path to the Imagens, follow this:

- Create a Session on YourPage.aspx.vb Page Load;
- Change the httpUploadHandler.ashx at this line: (this will enable the page to see the Sessions)
   public class HttpUploadHandler : IHttpHandler, System.Web.SessionState.IReadOnlySessionState{
- change the way the parameter is taken:
   _parameters = _httpContext.Session["Pasta"].ToString();

I've made this way, and its all right now.

Thank man, for the Code and the agility


Mar 10, 2011 at 11:03 AM
Edited Mar 10, 2011 at 11:04 AM

Hi, I am going crazy with a problem :D


AFTER uploading file/s how can refresh the page? This because I added into the default aspx page a gridview containing a files' list of Upload folder. But to bind the gridview I would need to refresh the page when uploads finish.

I tried to put this


into HttpUploadHandler.ashx but it doesn't run!

Help me please :)

Mar 10, 2011 at 11:59 AM

You need to do this at the clientside, with Javascript / AJAX.

Use the uploader's Javascript API to receive a notification when all files are finished and then refresh the page using javascript.

Mar 10, 2011 at 12:51 PM

Thank you for your quick reply.

But how can I use Javascript API? Can you write or link me an example to follow?

Mar 10, 2011 at 1:30 PM

There are javascript examples included within the solution in codeplex.

Mar 10, 2011 at 2:13 PM
Edited Mar 10, 2011 at 2:14 PM


I added this code in Default.aspx

var slCtl = null;

function AllFilesFinished() {

document.getElementById('AllFinishedDiv').style.display = 'block';



function pluginLoaded(sender) {

slCtl = document.getElementById("MultiFileUploader");

slCtl.Content.Files.AllFilesFinished = AllFilesFinished;

slCtl.Content.Files.SingleFileUploadFinished = SingleFileFinished;

slCtl.Content.Files.ErrorOccurred = ShowErrorDiv;

slCtl.Content.Control.MaximumFileSizeReached = ShowMaximumFileSizeDiv;

slCtl.Content.Files.FileAdded = UpdateFileList;

slCtl.Content.Files.FileRemoved = UpdateFileList;

slCtl.Content.Files.StateChanged = UpdateFileList;

slCtl.Content.Files.TotalPercentageChanged = UpdateTotalPercentage;


Finally I added this:

<param name="onload" value="pluginLoaded" />

into silverlightControlHost and.....