New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

BinaryImages and RadAsyncUpload in Grid

The Binary Images and RadAsyncUpload in Grid example illustrates the usage of RadAsyncUpload and RadBinaryImage and how to display and edit images. RadAsyncUpload offers asynchronous upload ability while maintaining the look of the regular RadUpload control. The upload process requires that the files are uploaded to a custom handler and not to the hosting page. Files are stored in a temporary location until a Postback occurs. The temporary location is cleaned-up automatically.

Some of the key advantages that RadAsyncUpload offers against RadUpload are

  • Uploads the file(s) automatically and asynchronously to the server

  • Integrated visual clue of the current operations - uploading, upload successfully completed, upload failed

  • Client side events for upload completed and upload failed

  • Simpler validation

    Binary Image with RadAsyncUpload in RadGrid

Consider the following important requirements when using RadAsyncUpload:

  • RadAsyncUpload requires the Telerik.Web.UI.WebResource handler to be registered in the web.config.

  • You need to ensure that any submit buttons on the page are disabled while upload is in progress. Otherwise, you cannot guarantee that the files will be uploaded successfully.

You can also perform validation over the file input as shown in the demo code:

JavaScript
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
  <script>
    var uploadedFilesCount = 0; var isEditMode; function validateRadUpload(source, e) {
      // When the RadGrid is in Edit mode the user is not obliged to upload file.
      if (isEditMode == null || isEditMode == undefined) {
        e.IsValid = false;
        if (uploadedFilesCount > 0) {
          e.IsValid = true;
        }
      }
      isEditMode = null;
    }
    function OnClientFileUploaded(sender, eventArgs) {
      uploadedFilesCount++;
    }
  </script>
</telerik:RadCodeBlock>

More information about the RadAsyncUpload you can find in the links below:

Overview

Getting Started

Migrating from RadUpload for ASP.NET Ajax to RadAsyncUpload

RadAsyncUpload vs. RadUpload for ASP.NET Ajax

Not finding the help you need?
Contact Support