Clear Selected Files

7 posts, 1 answers
  1. Meerkat
    Meerkat avatar
    64 posts
    Member since:
    Feb 2007

    Posted 06 May 2009 Link to this post

    Hello,

    I am slightly embarrased about asking for help on something so basic and probably obvious, but could you please tell me how to clear the list of Selected Files programmatically.

     

    Obviously the user does not want to see the last files he uploaded each time the RadUpload is made visible to him.

    Many thanks,

    Pete.


  2. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 06 May 2009 Link to this post

    Hello Pete,

    Have you tried clearing the Upload Items collection? The code may look like this:

            private void Button1_Click(object sender, System.Windows.RoutedEventArgs e) 
            { 
                RadUpload1.Items.Clear(); 
            } 
     

    I hope this helps.

    Regards,
    Konstantin Petkov
    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. Meerkat
    Meerkat avatar
    64 posts
    Member since:
    Feb 2007

    Posted 06 May 2009 Link to this post

    Hello Konstantin,

    Many thanks for your quick response.

    Your suggestion was almost perfect.
    The list of Selected Files were certainly cleared, but the Total bar, showing the number of bytes previously downloaded is still visible.

    Could I once again take advantage of your kindness and ask how to clear this bar as well.

    Best regards,

    Pete.
  5. Answer
    Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 06 May 2009 Link to this post

    Hi Pete,

    You can use the CancelUpload method.

    radUpload.CancelUpload(); 

    It clears the currently selected files but also will cancel any ongoing upload, so you can call it when no upload is going on to clear the items.

    Otherwise the Items.Clear() should also hide the total progress bar.  Thanks for bringing our attention to this, it has been logged as an issue.

    Best wishes,
    Miroslav
    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.
  6. Meerkat
    Meerkat avatar
    64 posts
    Member since:
    Feb 2007

    Posted 06 May 2009 Link to this post

    Cheers Miroslav,

    CancelUpload() did exactly what I wanted :-)

    Many thanks for your extremely quick reply.

    Best wishes,

    Pete.
  7. Angie
    Angie avatar
    33 posts
    Member since:
    Jul 2010

    Posted 05 Apr 2011 Link to this post

    I have some validation in FileUploadStarting event. Which is to check whether is there a file uploaded with the same name as
    e.UploadData.FileName if so i want to cancel the upload (or just give the option for user via RadConfirm messagebox)
     on FileUploadStarting event i tried to do this using (sender as RadUpload).CancelUpload() this error out the 
    Application
    
    Any solution for this
    
    Thanks a lot
    
    
  8. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 11 Apr 2011 Link to this post

    Hi Ravindranath,

    Have you tried using the Validate event of the RadUploadItem? It is raised for every RadUploadItem before uploading it. You can choose to cancel or not the item and it will not be uploaded. You can subscribe to this event either with the EventManager class or with AddHandler method.

    Kind regards,
    Alex Fidanov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
DevCraft banner