How to Preview image using telerik RadAsyncUpload and RadBinaryImage in ASP AJAX Panel?

3 posts, 0 answers
  1. Lalitha
    Lalitha avatar
    2 posts
    Member since:
    May 2015

    Posted 22 May 2015 Link to this post


     I'm New to telerik..Can any one tell me how to get preview of the image and also save to database ..Im using RadAsyncUpload...this is the code I'm Using 

      protected void RadAsyncUpload_FileUploaded(object sender, FileUploadedEventArgs e)
                string path = Server.MapPath("~/Uploads/");
                e.File.SaveAs(path + e.File.GetName());
                string ext = e.File.GetExtension();


    Thank you 

  2. Hristo Valyavicharski
    Hristo Valyavicharski avatar
    975 posts

    Posted 27 May 2015 Link to this post

    Hello Lalitha,

    You can use this code for previewing:

    <script type="text/javascript">
         function fileUploaded(sender, args) {
             var manager = $find("ajaxManager");
     <telerik:RadAjaxManager runat="server" ID="ajaxManager">
             <telerik:AjaxSetting AjaxControlID="ajaxManager">
                     <telerik:AjaxUpdatedControl ControlID="upload" />
                     <telerik:AjaxUpdatedControl ControlID="preview" />
     <telerik:RadAsyncUpload runat="server" ID="upload" OnFileUploaded="upload_FileUploaded" OnClientFileUploaded="fileUploaded"></telerik:RadAsyncUpload>
     <telerik:RadBinaryImage runat="server" ID="preview" />
    protected void upload_FileUploaded(object sender, FileUploadedEventArgs e)
        BinaryReader reader = new BinaryReader(e.File.InputStream);
        Byte[] data = reader.ReadBytes((int)e.File.InputStream.Length);
        preview.DataValue = data;

    This demo shows how to preview and insert images into database with RadAsyncUpload.

    I hope this helps.

    Hristo Valyavicharski
    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 Feedback Portal and vote to affect the priority of the items
  3. lakshmi
    lakshmi avatar
    1 posts
    Member since:
    Apr 2017

    Posted 12 Sep 2017 Link to this post

    Hi,I m new to Telerik i selected one image(I used telerik:RadAsyncUpload) after seleted the img(HTML img Tag) it is showing in the preview whatever we selected img.Now i m dng some postback.after doing the postback also i have to show the currently selected img in preview.Now it is showing previously selected img.Pls help me. It is urgent for me.
Back to Top