This is a migrated thread and some comments may be shown as answers.

Clear Selected Files

6 Answers 117 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Meerkat
Top achievements
Rank 1
Meerkat asked on 06 May 2009, 09:01 AM

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.


6 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 06 May 2009, 09:59 AM
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.
0
Meerkat
Top achievements
Rank 1
answered on 06 May 2009, 02:23 PM
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.
0
Accepted
Miroslav
Telerik team
answered on 06 May 2009, 02:33 PM
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.
0
Meerkat
Top achievements
Rank 1
answered on 06 May 2009, 02:47 PM
Cheers Miroslav,

CancelUpload() did exactly what I wanted :-)

Many thanks for your extremely quick reply.

Best wishes,

Pete.
0
Angie
Top achievements
Rank 1
answered on 05 Apr 2011, 11:15 PM
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

0
Alex Fidanov
Telerik team
answered on 11 Apr 2011, 08:52 AM
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
Tags
Upload
Asked by
Meerkat
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Meerkat
Top achievements
Rank 1
Miroslav
Telerik team
Angie
Top achievements
Rank 1
Alex Fidanov
Telerik team
Share this question
or