New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

How to Set Minimum File Inputs Count

RadUpload has been replaced by RadAsyncUpload, Telerik’s next-generation ASP.NET upload component. If you are considering Telerik’s Upload control for new development, check out the documentation of RadAsyncUpload or the control’s product page. If you are already using RadUpload in your projects, you may be interested in reading how easy the transition to RadAsyncUpload is and how you can benefit from it in this blog post. The official support for RadUpload has been discontinued in June 2013 (Q2’13), although it is still be available in the suite. We deeply believe that RadAsyncUpload can better serve your upload needs and we kindly ask you to transition to it to make sure you take advantage of its support and the new features we constantly add to it.

RadUpload exposes a property MaxFileInputsCount which specifies the maximum number of rows that can appear in the RadUpload control.

This example will show you how to implement "MinFileInputsCount" behavior - RadUpload will have at least one input rows.

<telerik:radupload id="RadUpload2" onclientdeleting="OnClientDeletingHandler" onclientdeletingselected="OnClientDeletingSelectedHandler"
    runat="server" />

function OnClientDeletingHandler(sender, eventArgs) {
    var numberOfInputs = sender.getFileInputs().length;
    if (numberOfInputs == 1) {
        eventArgs.set_cancel(true);
    }
}

function OnClientDeletingSelectedHandler(sender, eventArgs) {
    var numberOfInputsToDelete = eventArgs.get_fileInputFields().length;
    var totalNumberOfInputs = sender.getFileInputs().length;

    if (totalNumberOfInputs == numberOfInputsToDelete) {
        eventArgs.set_cancel(true);
    }
}

In this article