Avatar of ma701sss
ma701sss

asked on 

Display image with hidden field

I have the code below. This is some sampel code that I found, which retrieves filenames of photos in a particular directory. I'm hoping that somebody could please write the code to recursively look at each filename and then place the image on the page, with a an "add to cart" button beneath and the filename associated with this.
Private Sub Page_Load(s As Object, e As EventArgs)	 
    Dim dirInfo as New DirectoryInfo("C:\inetpub\wwwroot\website\photos")
    articleList.DataSource = dirInfo.GetFiles("*.jpg")
    articleList.DataBind()	 
End Sub
 
<asp:DataGrid runat="server" id="articleList" Font-Name="Verdana"
    AutoGenerateColumns="False" AlternatingItemStyle-BackColor="#eeeeee"
    HeaderStyle-BackColor="Navy" HeaderStyle-ForeColor="White"
    HeaderStyle-Font-Size="15pt" HeaderStyle-Font-Bold="True">
  <Columns>
    <asp:HyperLinkColumn DataNavigateUrlField="Name" DataTextField="Name" 
           HeaderText="File Name" />
    <asp:BoundColumn DataField="LastWriteTime" HeaderText="Last Write Time"
        ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" />
    <asp:BoundColumn DataField="Length" HeaderText="File Size"
		ItemStyle-HorizontalAlign="Right" 
		DataFormatString="{0:#,### bytes}" />
  </Columns>
</asp:DataGrid>

Open in new window

Editors IDEsMicrosoft DevelopmentASP.NET

Avatar of undefined
Last Comment
prairiedog

8/22/2022 - Mon