This is a migrated thread and some comments may be shown as answers.
How to Capture when the Upload Button is Clicked
1 Answer 31 Views
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 24 Jul 2012, 09:39 PM
From my searching around, I can't seem to find a definitive answer to this. I want my user-defined method to run once after the Upload button is clicked.

The FileExplorer ItemCommand event executes with ever file selected (I have EnableAsyncUpload as True). ItemCommand would cause my user-defined method to run per uploaded file, when I only want the method to run after the final upload.

I tried to keep track of RadFileExplor1.Upload.UploadedFiles.Count, thinking I could execute my method when MyCount == UploadedFiles.Count. The UploadedFiles.Count returns zero (0) on the Page_Load event (when the page is initially opened), but when Page_Load runs again on a postback (after clicking the Upload button), UploadedFiles.Count always throws a null exception.

So how do I get my method to run once immediately after the Upload button is clicked?

Thank You,
Steven

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 25 Jul 2012, 05:43 AM
Hi Steven,

You can get the count using From "FileExplorer1.AsyncUpload.UploadedFiles.Count" .Try the code snippets below.

ASPX:
static int count = 0;
protected void Page_Load(object sender, EventArgs e)
{
 count = 0;
}
protected void FileExplorer1_ItemCommand(object sender, Telerik.Web.UI.RadFileExplorerEventArgs e)
{
 if ((FileExplorer1.AsyncUpload != null) && (e.Command.ToString() == "UploadFile"))
 {
  count++;
  if (count == FileExplorer1.AsyncUpload.UploadedFiles.Count)
  {
   // Your code
  }
 }
}

Hope this helps.

Thanks,
Princy.
Asked by
Brian
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or