Using ArrayList & Repeater

G

Guest

I have an arraylist storing objects that I've defined my own. The object is
called Stock. And each stock has attributes like Comp, PartNo, Model, and
etc. I want to bind this arraylist with a repeater. But I always get an error
message:

"No default member found for type Stock."

This is where the error came from:

<ItemTemplate>
<tr>
<td align=center><%# Container.DataItem("Comp") %></td>
<td align=center width="168"><%# Container.DataItem("Model") %></td>
<td align=center width="115"><%# Container.DataItem("Part") %></td>
<td align=center width="47"><%# Container.DataItem("WIPQty") %></td>
<td align=center><%# Container.DataItem("FGQty") %></td>
<td align=center><%# Container.DataItem("ReservedQty") %></td>
<td align=center><%# Container.DataItem("AvailQty") %></td>
<TD align=center><%# Container.DataItem("POBal") %></TD>
</tr>
</ItemTemplate>

The question I want to ask is, how do you bind a arraylist that stores
objects with a repeater?
 
E

Eliyahu Goldin

Assuming that the arraylist stores objects of type Stock, try

<td align=center><%# ((Stock) Container.DataItem).Comp %></td>

For the repeater you should specify DataSource=''<%# MyArrayList %>"

Eliyahu
 

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,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top