I have a basic repeater as such:
<asp:Repeater id="BlogDisplay" runat="server">
<HeaderTemplate>
<table>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td valign="top" align="left" style="font-weight:bold; padding-left:3px;">
<%# DataBinder.Eval(Container.DataItem, "Title")%>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
When I execute the code I get an exception: DataBinding: 'DocumentWebParts.BlogPostLost.BlogItem' does not contain a property with the name 'Title'.

So you’re probably thinking that my BlogItem object doesn’t have a Title property – but that’s not the case!
public class BlogItem
{
public int Id;
public string Body;
public string Title;
public string Author;
public DateTime Published;
}
And the property is certainly being set – throwing a breakpoint shows that all values have been set.
BlogItems = new List<BlogItem>();
SPListItem item;
foreach (SPListItem i in myItems)
{
//off-topic code hidden
BlogItem b = new BlogItem();
b.Id = Id;
b.Body = Body;
b.Author = Author;
b.Title = Title;
b.Published = Published;
BlogItems.Add(b);
}
BlogItems = BlogItems.OrderByDescending(x => x.Id).ToList();
BlogDisplay.DataSource = BlogItems;
BlogDisplay.DataBind();
So in light of all of this, why am I getting the above exception when I use DataBinder.Eval(Container.DataItem, "Title") in the repeater?
Change BlogItem to this:
You are using fields; it expects properties.