How to clear RadUpload file (but keep widget) from the client side?

Thread is closed for posting
4 posts, 0 answers
  1. Robert Columbia
    Robert Columbia avatar
    14 posts
    Member since:
    Jun 2012

    Posted 20 Aug 2010 Link to this post

    I have a RadUpload that always shows exactly one upload field.  I have a requirement to clear the input field from elsewhere on the page.  The input element should still remain (if I have to temporarily "delete" it and then remake it, that is ok as long as it still works with postback, e.g. if it has the same clientid), and remain usable, just without the file that was previously selected there.  Is there an easy way to do this with Telerik's clientside api, or do I need to get dirty with raw dhtml?  I should not use IE specific features.


    Telerik.Web.UI.dll 2010.2.713.35
  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 23 Aug 2010 Link to this post

    Hi Robert Columbia,

    You can use use the upload.clearFileInputAt(index) method on the client side. Here is a sample function clearing all Inputs in the Upload:
    function clearAllInputs()
    {
      var upload = $find("<%= RadUpload1.ClientID %>");
      var fileInputs = upload.getFileInputs();
      for (var i=fileInputs.length - 1; i >= 0; i--)
      {
          upload.clearFileInputAt(i);
      }
    }

    Greetings,
    Simon
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lighthouse Developer
    Lighthouse Developer avatar
    34 posts
    Member since:
    Feb 2010

    Posted 13 Jan 2011 Link to this post

    Is clearFileInputAt(index) still available in the latest telerik version? Doesn't work for me, seems as the method is not supported anymore.
  5. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 18 Jan 2011 Link to this post

    Hello Robert Columbia,

    Yes, the method is supported in the latest version. Please see this demo.

    Greetings,
    Simon
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top