S
Stefan Landgraf
I try binding a DataList to an ArrayList of objects but keep getting the error:
DataBinder.Eval: 'espod.myClass' does not contain a property with the name Name
Heres the code:
<aspataList id="DataList1" runat="server">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem,"Name") %>
</ItemTemplate>
</aspataList>
class myClass
{
public string Name;
public myClass(string name)
{
Name = name;
}
}
public class test : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataList DataList1;
private void Page_Load(object sender, System.EventArgs e)
{
ArrayList al = new ArrayList();
al.Add(new myClass("Peter"));
al.Add(new myClass("Mary"));
DataList1.DataSource = al;
DataList1.DataBind();
}
}
Does anyone know whats wrong here?
Stefan
DataBinder.Eval: 'espod.myClass' does not contain a property with the name Name
Heres the code:
<aspataList id="DataList1" runat="server">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem,"Name") %>
</ItemTemplate>
</aspataList>
class myClass
{
public string Name;
public myClass(string name)
{
Name = name;
}
}
public class test : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataList DataList1;
private void Page_Load(object sender, System.EventArgs e)
{
ArrayList al = new ArrayList();
al.Add(new myClass("Peter"));
al.Add(new myClass("Mary"));
DataList1.DataSource = al;
DataList1.DataBind();
}
}
Does anyone know whats wrong here?
Stefan