Link to home
Start Free TrialLog in
Avatar of msout
msout

asked on

Display images from directory

I need to display images from the directory. I use datalist and it shows images but it also shows link -Thumbs.db on the page. When I click the link -there is nothing. I do not have this db in my directory. How can I get rid of this Thumbs.db link on the page?
Please, advise

My apsx form:
 <asp:DataList ID="dtlist" runat="server" RepeatColumns="3" CellPadding="5">
<ItemTemplate>
<asp:Image Width="100" ID="Image1" ImageUrl='<%# Bind("Name", "~/Images1/{0}") %>' runat="server" />
<br />
<asp:HyperLink ID="HyperLink1" Text='<%# Bind("Name") %>' NavigateUrl='<%# Bind("Name", "~/Images1/{0}") %>' runat="server"/>
</ItemTemplate>
<ItemStyle BorderColor="Brown" BorderStyle="dotted" BorderWidth="3px" HorizontalAlign="Center"
VerticalAlign="Bottom" />
</asp:DataList>

My code:

Public Sub BindDataList()


        Dim dir As New DirectoryInfo(MapPath("Images1"))
        Dim files As Array = dir.GetFiles()
        Dim ListItems As New ArrayList
        For Each FileInfo In files
           ListItems.Add(FileInfo)
        Next
       dtlist.DataSource = ListItems
        dtlist.DataBind()

   End Sub
ASKER CERTIFIED SOLUTION
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial