September 2012 Blog Posts

This one’s for my reference, mostly; hopefully I don’t spend hours trying to debug this error next time.

The scenario is that you’re using an EntityDataSource to bind some entities to a ListView. Inside the ListView, you’ve got a nested data-bound control that’s trying to bind to a collection property of the current entity.

For example, you bind a list of CustomerOrder entities to the parent ListView, and then bind the collection of CustomerOrder.CustomerOrderLines to a child ListView to render the products the customer has purchased on each order.

Using the EntityDataSource in its default state gives you this:

DataBinding: 'System.Web.UI.WebControls.EntityDataSourceWrapper' does not contain a property with the name 'CustomerOrderLine'.

…and a nice big stack trace.

The issue is that we’re using the EntityDataSourceWrapper and not our actual entity. The solution? Stop using the wrapper!

Disable flattening, like this:


Easy. Now, don’t forget about this again, future-Sam!


Site Sections

Recent Posts


Post Categories

WHS Add-In Tutorial

WHS Blogs

WHS Development