Dynamically displaying a bunch images using Ajax RRS feed

  • Question

  • User-1561933206 posted


    I have a bunch of images stored in a List<string> storing the paths of the images which I have obtained using AjaxFileUpload.

    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </asp:ToolkitScriptManager>
    <asp:ajaxfileupload ID="Ajaxfileupload1" runat="server" OnUploadComplete="FileUploadComplete" OnUploadCompleteAll="FileUploadCompleteAll" EnableViewState="true" >
    <asp:UpdatePanel ID="_updatePanel" runat="server">
         <asp:PlaceHolder ID="_ph" runat="server">

    In codebehind, I have

    protected void FileUploadCompleteAll(object sender, System.EventArgs e)
      for (int i = 0; i < fN.Count; i++)
         System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
         img.ImageUrl = fN[i];

    fN is a List<string> and has all the image paths.

    Please let me know what wrong I am doing here and a possible fix.

    Thank you

    Friday, April 18, 2014 8:10 PM


All replies

  • User1208776063 posted

    img.ImageUrl = fN[i];

    You need to make sure that images are downloaded to some temporary location on the server. Then, you can use Server.MapPath("~/tempImages/"+Path.GetFileName(fn[i])); Otherwise, uploaded file path will the path of the file on client's machine such as C://myfile.jpg.  Debug and see what's being saved in the list fn.

    Friday, April 18, 2014 8:33 PM
  • User-1561933206 posted

    Hi dotnetzoom,

    fN[i] does have the complete path of the images. Could the problem be related to the PlaceHolder I am using?

    I tried using Panel instead of PlaceHolder but even that didn't work. Am I suppose to use some kind of RenderControl to display the images?

    When I try to debug, images get added to the PlaceHolder but nothing happens at the end of FileUploadAll method.

    Saturday, April 19, 2014 12:30 AM
  • User-933407369 posted

    i would suggest you try the code or place the Ajaxfileupload into the UpdatePanel :


    please refer to the link for details:

    Understanding ASP.NET AJAX UpdatePanel Triggers


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 21, 2014 2:51 AM
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 22, 2014 12:25 AM