I have an entity object that contains entities with properties I wish to bind to grid columns. When binding, I recieve the following exception:
DataBinding: 'EFPoC.OrderDetail+GridItem' does not contain a property with the name 'entity.PartNumber'.
However, my entity does have a property named 'entity' which contains a property named 'PartNumber'.
This seems like it should 'just work' so can anyone help me determine what I've missed? BTW, the exception is thrown when I make the call to CartGrid.DataBind();
Thanks in advance!
Regards, Scott
Here's my entity - I'm binding to a list of these.
My grid is defined like this:
I'm using this loading code:
DataBinding: 'EFPoC.OrderDetail+GridItem' does not contain a property with the name 'entity.PartNumber'.
However, my entity does have a property named 'entity' which contains a property named 'PartNumber'.
This seems like it should 'just work' so can anyone help me determine what I've missed? BTW, the exception is thrown when I make the call to CartGrid.DataBind();
Thanks in advance!
Regards, Scott
Here's my entity - I'm binding to a list of these.
| public class GridEntity { |
| public bool Checked; |
| public CartItem entity; |
| } |
My grid is defined like this:
| <telerik:RadGrid ID="CartGrid" runat="server" |
| GridLines="None" |
| Skin="Vista" |
| EnableViewState="true" |
| OnItemCommand="CartGrid_OnItemCommand"> |
| <HeaderContextMenu EnableTheming="True"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </HeaderContextMenu> |
| <MasterTableView AutoGenerateColumns="false" |
| DataKeyNames="entity.PartNumber,entity.ItemLegalName" |
| ClientDataKeyNames="entity.PartNumber,entity.ItemLegalName"> |
| <Columns> |
| <telerik:GridCheckBoxColumn DataField="Checked" HeaderText="Selected" > |
| <HeaderStyle Width="10%" /> |
| </telerik:GridCheckBoxColumn> |
| <telerik:GridBoundColumn DataField="entity.PartNumber" HeaderText="Kit #"> |
| <HeaderStyle Width="20%" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="entity.ItemLegalName" HeaderText="Kit Name"> |
| <HeaderStyle Width="55%" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridButtonColumn ButtonType="PushButton" CommandName="removeFromCart" CommandArgument="0" Text="remove item" ConfirmDialogType="RadWindow"> |
| <HeaderStyle Width="15%" /> |
| </telerik:GridButtonColumn> |
| </Columns> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| </MasterTableView> |
| <FilterMenu EnableTheming="True"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </FilterMenu> |
| </telerik:RadGrid> |
I'm using this loading code:
| using (CartServiceClient client = new CartServiceClient()) |
| { |
| Cart cart = client.GetCart(UserEntityID); |
| var entityList = from item in cart.CartItems |
| select new GridItem { |
| Checked = false, |
| entity = item |
| }; |
| CartGrid.DataSource = entityList; |
| CartGrid.DataBind(); |
| } |