Q1 2009 -> Q2 2009 breaking change

3 posts, 1 answers
  1. sherwin
    sherwin avatar
    3 posts
    Member since:
    Mar 2009

    Posted 16 Jul 2009 Link to this post

    Hi,

    A change in the RadUpload component between Q1 and Q2 release has broken some functionality in my application:

    My app handles the RadUpload.UploadCanceled event, where I check if *any* of the files were uploaded succesfully before the user clicked cancel:

     private void RadUpload1_UploadCanceled(object sender, EventArgs e) 
       if (RadUpload1.CurrentSession.UploadedFiles.Count > 0) 
       { 
         //some files *did* upload succesfully, so do something... 
       }         

    This code works just fine in Q1, but in Q2, CurrentSession.UploadedFiles.Count is *always' zero regardless of how many files were uploaded prior to clicking 'cancel'.

    I have compared the Q1 and Q2 RadUpload components using Reflector, and have found a change in Q2 that resets the RadUpload session *before* raising the UploadCanceled event:

    Q1 code:
    public void CancelUpload() 
        if (this.CurrentSession.uploaders.Count > 0) 
        { 
            this.CurrentSession.uploaders.Peek().Cancel(); 
        } 
        this.SetInitialUIState(); 
     

    Q2 code:
    public void CancelUpload() 
        if (this.CurrentSession.Uploaders.Count > 0) 
        { 
            this.CurrentSession.Uploaders.Peek().Cancel(); 
        } 
        this.CurrentSession.Reset(); 
        this.SetInitialUIState(); 
     
      
     
      
     

    Note the new call to this.CurrentSession.Reset(), this is whats causing me problems! I can work around this by manually tracking how many files have successfully been uploaded, but this smells like a bug to me. Or perhaps you need to add an 'UploadCanceling' event, to be raised prior to 'UploadCanceled', where the session info would still be intact.
  2. Answer
    Ivan
    Admin
    Ivan avatar
    519 posts

    Posted 16 Jul 2009 Link to this post

    Hello Sherwin,

    Thank you for reporting the issue.

    We would like to apologize for the inconvenience. Yes we are confirming that the upload cancelation clears the CurrentSession. The fix was scheduled - we hope it will be available for the upcoming SP1 release. Meanwhile you can workaround using UploadStarted, FileUploaded and UploadCanceled events:
     
    private void RadUpload1_UploadStarted(object sender, FileUploadedEventArgs e) 
        this.uploaded = 0; 
     
    private void RadUpload1_FileUploaded(object sender, FileUploadedEventArgs e) 
        if (e.HandlerData.IsSuccess) 
        { 
            this.uploaded++; 
        } 
     
    private void RadUpload1_UploadCanceled(object sender, FileUploadedEventArgs e) 
        if (this.uploaded > 0) 
        { 
            // ... your code here 
        } 

    Your Telerik points are updated according to reporting the issue.

    All the best,
    Ivan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. sherwin
    sherwin avatar
    3 posts
    Member since:
    Mar 2009

    Posted 16 Jul 2009 Link to this post

    thank for confirming it, your fix is exactly what i did to work around this issue :-)
Back to Top