I have an arraylist:
Dim downloadsarray As New ArrayList
downloadsarray.Add(iconlink)
downloadsarray.Add(imgpath)
downloadsarray.Add(filesize)
downloadsarray.Add(description)
Which is the datasource of my repeater:
DownloadsRepeater.DataSource = downloadsarray
DownloadsRepeater.DataBind()
Please can you tell me how I output the items in the array to the .aspx page. I usually use (when using sqldatareader as datasource):
<%#Container.DataItem("1stcolumnnamestring")%>
<%#Container.DataItem("2ndcolumnnamestring")%>
But this does not work when using the arraylist as datasource.
Thanks.
ps… I know how to use <%#Container.DataItem%> to dump everything but I need to get at the items in the array individually, not have them all ditched out to the page in one go. For example, item 1 contains a link, item 2 contains an image path, item 3 contains a description. I need to have them kick out in the correct order to build the link and icon correctly.
In your example, you should be able to do this:
Typically, when binding to a repeater, each data item holds the same type of data. In your example, each item is different – one is the link, one is the image path, etc. This is fine if all you want to display are those exact items (though I would then question whether you need a repeater to do the job).
If your intent is to show multiple links, you should create a class for each link and add instance of the class to your ArrayList:
and in the aspx page: