Repeater control with Arraylist

F

fix

Hi all,

I am trying to bind some data I got in an ArrayList, how is that possible? I
see no example in the help.
The code behind to bind is simple:

rptItems.DataSource = alist
rptItems.DataBind()

But I just don't know what to write in the ItemTemplate in the HTML.

Please help.
fix.
 
W

Wilco Bauwer

Pretty much the same as you'd write with any other object you bind
against. E.g.:

<ItemTemplate>
Bla: <%# ((TypeOfObject)Container.DataItem).Whatever %> or <%#
DataBinder.Eval(Container.DataItem, "Whatever") %>
</ItemTemplate>
 
F

fix

The things I insert to the Arraylist is not objects, it is some strings or
integers. So it doesn't have any "whatever" property. What do I do?
Thanks.
fix.
 
W

Wilco Bauwer

Container.DataItem just represents an item in the data source. In your
case you can just do <%# Container.DataItem %> instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top