Using ArrayList & Repeater

Discussion in 'ASP .Net' started by Guest, May 17, 2005.

  1. Guest

    Guest 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?
     
    Guest, May 17, 2005
    #1
    1. Advertisements

  2. 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
     
    Eliyahu Goldin, May 17, 2005
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.