次の完全な解決策を試してください。
aspx ページ:
<asp:ListView ID="ListView1" runat="server">
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" ToolTip='<%#Eval("Name")%>'/>
</ItemTemplate>
</asp:ListView>
aspx.vb ページ:
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim di As New IO.DirectoryInfo(Server.MapPath("Images/emoticons/"))
Dim diar1 As IO.FileInfo() = di.GetFiles()
Dim dra As IO.FileInfo
Dim FileList As New List(Of IO.FileInfo)
'list the names of all files in the specified directory
For Each dra In diar1
FileList.Add(dra)
Next
ListView1.DataSource = FileList
ListView1.DataBind()
End Sub
Protected Sub ListView1_ItemDataBound(sender As Object, e As System.Web.UI.WebControls.ListViewItemEventArgs) Handles ListView1.ItemDataBound
Dim ImageButton1 As ImageButton
If e.Item.ItemType = ListViewItemType.DataItem Then
Dim rowView As IO.FileInfo = e.Item.DataItem()
Dim FileName As String = rowView.Name.ToString()
ImageButton1 = e.Item.FindControl("ImageButton1")
ImageButton1.ImageUrl = "~/Images/emoticons/" & FileName
End If
End Sub