Q:

Repeater filled from List, how do I get the class in the webform?

In my codebehind im filling a repeater with this class:
public class Reference
{
    public string PageType;
    public string Url;
    public string Name;
}

And this code:
var NewReference = new Reference();
NewReference.Name = "Hello World"
TheList.Add(NewReference);
TheRepeater.DataSource = TheList;
TheRepeater.DataBind();

How do I get the "Name", "PageType" and "Url" in the webform?
I tried:
<%# Eval("Name") %>

With no luck...

A:

As first step - ensure that code which fills in DataSource executes (just put a breakpoint).
Try out putting it in label
<asp:Label runat="server">
    <%# Eval("Name") %>
</asp:Label>

Also you can add more formatting if needed
<asp:Label runat="server">
    <%# String.Format("Name = {0}", Eval("Name")) %> 
</asp:Label>

For more details see MSDN Data-Binding Expressions Overview

