How to Capture when the Upload Button is Clicked

2 posts, 0 answers
  1. Brian
    Brian avatar
    68 posts
    Member since:
    Jun 2011

    Posted 24 Jul 2012 Link to this post

    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,
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 25 Jul 2012 Link to this post

    Hi Steven,

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

    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"))
      if (count == FileExplorer1.AsyncUpload.UploadedFiles.Count)
       // Your code

    Hope this helps.

Back to Top