... Now I recieve the following error:
No default member found for type 'FileInfo'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.MissingMemberException: No default member found for type 'FileInfo'.
Source Error:
Line 131: <ItemTemplate>
Line 132: <tr>
Line 133: <td width="100%" valign="top"><a target="_blank" href="Pics/Images/<%# Container.DataItem("aLocalFiles") %>"><img src="Pics/Thumbs/<%# Container.DataItem("aLocalFiles") %>"></a></td>
Line 134: </tr>
Line 135: </ItemTemplate> |
Source File: c:\inetpub\wwwroot\sss\Pics\DisplayPics.aspx Line: 133
Stack Trace:
[MissingMemberException: No default member found for type 'FileInfo'.]
Microsoft.VisualBasic.CompilerServices.LateBinding.LateIndexGet(Object o, Object[] args, String[] paramnames) +1367
ASP.DisplayPics_aspx.__DataBind__control4(Object sender, EventArgs e) in c:\inetpub\wwwroot\sss\Pics\DisplayPics.aspx:133
System.Web.UI.Control.OnDataBinding(EventArgs e) +66
System.Web.UI.Control.DataBind() +26
System.Web.UI.Control.DataBind() +86
System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +127
System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +475
System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +49
System.Web.UI.WebControls.Repeater.DataBind() +23
sss.DisplayPics.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\Floris den Heijer\VSWebCache\192.168.1.35\sss\Pics\DisplayPics.aspx.vb:48
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
|
With the code-behind file:
Dim sLocalDir, ThisFileName As String
sLocalDir = Server.MapPath("Images/")
If Not Directory.Exists(sLocalDir) Then
Exit Sub
Else
Dim oLocalFile As FileInfo
Dim aLocalFiles As FileInfo() = (New DirectoryInfo(sLocalDir)).GetFiles("*.jpg")
Do While aLocalFiles.Length > 0
PicsRepeater.DataSource = aLocalFiles
PicsRepeater.DataBind()
Loop
End If
And The ASPX file:
<asp:Repeater id="PicsRepeater" runat="server"><HeaderTemplate>
<table width="100%" class="regular" cellpadding="5" cellspacing="0" border="1" bordercolor="#B7B7B7">
<tr>
<td width="100%" bgcolor="#D0D0D0"><strong>Foto:</strong></td>
</tr>
<tr>
<td width="100%"> </td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td width="100%" valign="top"><a target="_blank" href="Pics/Images/<%# Container.DataItem("aLocalFiles") %>"><img src="Pics/Thumbs/<%# Container.DataItem("aLocalFiles") %>"></a></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
If you want, you can help me, but I think I can handle this one, it's more like to inform you.