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

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

3 Answers 208 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Robert Columbia
Top achievements
Rank 1
Robert Columbia asked on 20 Aug 2010, 10:12 PM
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

3 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 23 Aug 2010, 11:28 AM
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
0
Lighthouse Developer
Top achievements
Rank 1
answered on 13 Jan 2011, 09:34 AM
Is clearFileInputAt(index) still available in the latest telerik version? Doesn't work for me, seems as the method is not supported anymore.
0
Simon
Telerik team
answered on 18 Jan 2011, 05:35 PM
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.
Tags
Upload (Obsolete)
Asked by
Robert Columbia
Top achievements
Rank 1
Answers by
Simon
Telerik team
Lighthouse Developer
Top achievements
Rank 1
Share this question
or