How to return to initial status after upload a file

2 posts, 0 answers
  1. Chen
    Chen avatar
    18 posts
    Member since:
    Apr 2012

    Posted 26 Jun 2012 Link to this post


    I just start to use this control and have an issue about it.

    My case is very simple. I only allow users to upload one file at a time, so when the upload finished, I want to change the radupload control to its initial status, which means the file progress bar, total progress bar and the cancel button should be hidden, only the browse button shows up.

    Is there any way to do it?

    Thanks in advance for any input.
  2. Tina Stancheva
    Tina Stancheva avatar
    3298 posts

    Posted 28 Jun 2012 Link to this post

    Hi Chen,

    You can use the RadUpload.CancelUpload() method (read more) to reset the upload control's state. You only have to make sure that when you call this method, the upload process and session are completely finished and the state of the control reflects that. This is why if you decide to handle he RadUpload.UploadFinished event to reset its state, you need to delay the execution of the CancelUpload() method. For example you can invoke the method in a Dispatcher:
    private void RadUpload1_UploadFinished(object sender, RoutedEventArgs e)
        Dispatcher.BeginInvoke(() =>
            (sender as RadUpload).CancelUpload();

    Give this a try and let us know if it helps or if you have any other questions regarding the RadUpload control.

    Kind regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft R3 2016 release webinar banner
Back to Top