B
Bob Lehmann
Hi,
I'm trying to bind an ArrayList to a DataList.
I get the error
DataBinder.Eval: 'System.String' does not contain a property with the name
Name.
I don't know what property of ArrayList I should be using instead of "Name"
in default.aspx.
Can someone point me in the right direction?
default.aspx.vb -
Dim di As New DirectoryInfo(Current.Server.MapPath("images/position"))
Dim FileList As FileInfo() = di.GetFiles()
Dim File As FileInfo
Dim ary As New ArrayList
For Each File In FileList
ary.Add(File.Name)
Next
ThumbList.DataSource = ary
ThumbList.DataBind()
default.aspx -
<asp:datalist id="ThumbList"
repeatdirection="Horizontal"
repeatcolumns="5"
gridlines="Both"
repeatlayout="Table"
itemstyle-cssclass="thumb"
runat="server">
<itemtemplate>
<img src='images/position/thumb/<%#DataBinder.Eval(Container,
"DataItem.Name")%>">' border='0'></a>
</itemtemplate>
</asp:datalist>
Thanks,
Bob Lehmann
I'm trying to bind an ArrayList to a DataList.
I get the error
DataBinder.Eval: 'System.String' does not contain a property with the name
Name.
I don't know what property of ArrayList I should be using instead of "Name"
in default.aspx.
Can someone point me in the right direction?
default.aspx.vb -
Dim di As New DirectoryInfo(Current.Server.MapPath("images/position"))
Dim FileList As FileInfo() = di.GetFiles()
Dim File As FileInfo
Dim ary As New ArrayList
For Each File In FileList
ary.Add(File.Name)
Next
ThumbList.DataSource = ary
ThumbList.DataBind()
default.aspx -
<asp:datalist id="ThumbList"
repeatdirection="Horizontal"
repeatcolumns="5"
gridlines="Both"
repeatlayout="Table"
itemstyle-cssclass="thumb"
runat="server">
<itemtemplate>
<img src='images/position/thumb/<%#DataBinder.Eval(Container,
"DataItem.Name")%>">' border='0'></a>
</itemtemplate>
</asp:datalist>
Thanks,
Bob Lehmann