C# Repeater Bindings to SQL and Objects

For a dataset from SQL the below will retrieve the field from the resultset called ‘Name’
<%#DataBinder.Eval(Container.DataItem, "Name")%>

For a list the below will retrieve the member variable Fred from each of the objects appears to work for ASP.NET
<%#Container.DataItem.Fred%>

or for C#
<%#Eval("name")%>
Remember your class must define getters and setters
public string name { get; set; }

Leave a Reply