Binding DataList to ArrayList

  • Thread starter Thread starter Charlie
  • Start date Start date
C

Charlie

Hi:

I'm trying to bind a DataList to an ArrayList of POC object instances.

this.DataList.DataSource = BizEntity.thePOCs; // thePOCs is an ArrayList of
POC's which is member of BizEntity class
this.DataList.DataBind();

In the HTML I have an ItemTemplate with an expression that binds to a Fname
property of POC object like so:

<%# DataBinder.Eval(Container.DataItem, "Fname") %>

I get error saying Fname is not property of POC, but it is and it contains
data. Any ideas?

Thanks,
Charlie
 
Hi,

Try to use this expression

<%# ((POC)Container.DataItem).Fname %>

Cheers,
 
Back
Top