c# - I make fileUpload to save images in folder now i want to display it -


that code url of image folder

 <asp:repeater id="rptimages" runat="server">     <itemtemplate>         <li>             <img alt="" style='height: 75px; width: 75px' src='<%# eval("images") %>' />          </li>     </itemtemplate> </asp:repeater> 

this display images

string[] filesindirectory = directory.getfiles(server.mappath("~/images")); list<string> images = new list<string>(filesindirectory.count());  foreach (string item in filesindirectory) {     images.add(string.format("~/images/{0}", system.io.path.getfilename(item))); }  rptimages.datasource = images; rptimages.databind(); 

when run it says:" error occurred during compilation of resource required service request. please review following specific error details , modify source code appropriately. "

and show :( list<string> images = new list<string>(filesindirectory.count());) in red

what should do?

i have not encountered error mentioned, found error on binding.

here should change binding using container.dataitem , since using ~ path should add runat="server" mentioned in link.

<img alt="" style='height: 75px; width: 75px' src='<%# container.dataitem %>' runat="server"/> 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -