[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 938
  • Last Modified:

DataBinder.Eval: 'System.Data.Common.DbDataRecord' does not contain a property with the name Sizes.

I am getting the following error. I've been looking at it too long to see what i've missed. Please help.

DataBinder.Eval: 'System.Data.Common.DbDataRecord' does not contain a property with the name Sizes.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: DataBinder.Eval: 'System.Data.Common.DbDataRecord' does not contain a property with the name Sizes.

Source Error:

Line 62:                                                                                           <asp:TemplateColumn HeaderText="Size">
Line 63:                                                                                                 <ItemTemplate>
Line 64:                                                                                                       <asp:Label id="Size" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Sizes") %>' width="40px" />
Line 65:                                                                                                 </ItemTemplate>
Line 66:                                                                                           </asp:TemplateColumn>

Source File: c:\inetpub\wwwroot\dev.company.com\ShoppingCart.aspx    Line: 64

Stack Trace:

[HttpException (0x80004005): DataBinder.Eval: 'System.Data.Common.DbDataRecord' does not contain a property with the name Sizes.]
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +147
   System.Web.UI.DataBinder.Eval(Object container, String[] expressionParts) +71
   System.Web.UI.DataBinder.Eval(Object container, String expression) +82
   ASP.ShoppingCart_aspx.__DataBind__control15(Object sender, EventArgs e) in c:\inetpub\wwwroot\dev.company.com\ShoppingCart.aspx:64
   System.Web.UI.Control.OnDataBinding(EventArgs e) +66
   System.Web.UI.Control.DataBind() +26
   System.Web.UI.Control.DataBind() +86
   System.Web.UI.Control.DataBind() +86
   System.Web.UI.WebControls.DataGrid.CreateItem(Int32 itemIndex, Int32 dataSourceIndex, ListItemType itemType, Boolean dataBind, Object dataItem, DataGridColumn[] columns, TableRowCollection rows, PagedDataSource pagedDataSource) +169
   System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean useDataSource) +1403
   System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +49
   System.Web.UI.WebControls.BaseDataList.DataBind() +23
   ASPNET.StarterKit.Commerce.ShoppingCart.PopulateShoppingCartList() in c:\inetpub\wwwroot\company\shoppingcart.aspx.cs:118
   ASPNET.StarterKit.Commerce.ShoppingCart.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\company\shoppingcart.aspx.cs:44
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +750

Here is some of the code. Let me know if you need more.

                                                                                          <asp:TemplateColumn HeaderText="Product&#160;ID">
                                                                                                      <asp:Label id="ProductID" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ProductID") %>' />
                                                                                          <asp:BoundColumn DataField="ModelName" HeaderText="Product Name"></asp:BoundColumn>
                                                                                          <asp:BoundColumn DataField="ModelNumber" HeaderText="Model"></asp:BoundColumn>
                                                                                          <asp:TemplateColumn HeaderText="Size">
                                                                                                      <asp:Label id="Size" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Sizes") %>' width="40px" />
                                                                                          <asp:TemplateColumn HeaderText="Quantity">
                                                                                                      <asp:TextBox id="Quantity" runat="server" Columns="4" MaxLength="3" Text='<%# DataBinder.Eval(Container.DataItem, "Quantity") %>' width="40px" />
                                                                                          <asp:BoundColumn DataField="UnitCost" HeaderText="Price" DataFormatString="{0:c}"></asp:BoundColumn>
                                                                                          <asp:BoundColumn DataField="ExtendedAmount" HeaderText="Subtotal" DataFormatString="{0:c}"></asp:BoundColumn>
                                                                                          <asp:TemplateColumn HeaderText="Remove">
                                                                                                            <asp:CheckBox id="Remove" runat="server" />
1 Solution
Does the table that you binds to the datagrid has a column Sizes?
dbruyereAuthor Commented:
Yes. Sorry, it was a stored procedure problem. Finally realized it after 3 hours of being braindead.
The question has been PAQ'd and the 500 points have been refunded.
Community Support Moderator

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now