This is a migrated thread and some comments may be shown as answers.

Does not contain a property with the name

2 Answers 442 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Ben asked on 18 Oct 2013, 03:09 PM
Hi All,

I have been searching for a fix for this issue but I dont feel im getting very far.

I have a grid with a DetailTables/GridTableView to expand the rows.

The grid is bound to a list of objects, these objects has a property which is another list of objects which holds the 'Code' property.

This issue does not happen on our dev servers, only on the production server.


<telerik:radgrid id="grdData" height="400px" width="100%" runat="server"
                        pagesize="50" showstatusbar="True" allowmultirowselection="False" allowpaging="True"
                        autogeneratecolumns="False" allowsorting="true" gridlines="None" cssclass="gridControl"
                        onneeddatasource="OnNeedDataSource" ondetailtabledatabind="RadGrid1_grdData"
                        <pagerstyle mode="NumericPages"></pagerstyle>
                        <clientsettings allowcolumnsreorder="False" reordercolumnsonclient="False">
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                        <mastertableview width="98%" summary="Data" clientdatakeynames="PropertyA, PropertyB, PropertyC, PropertyD, PropertyE">
                                <telerik:GridTableView AutoGenerateColumns="false" DataKeyNames="Code,DisplayValue" Width="100%">
                                        <telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False" DataField="DisplayValue"
                                            Display="True" HeaderText="Display Value" ReadOnly="True" Reorderable="True" Resizable="True"
                                            ShowSortIcon="False" UniqueName="DisplayValue" Visible="True">
                                        <telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False" DataField="Code"
                                            Display="True" HeaderText="Code" ReadOnly="True" Reorderable="False" Resizable="True"
                                            ShowSortIcon="False" UniqueName="Code" Visible="True">
                                <telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False" DataField="PropertyA"
                                    Display="True" HeaderText="PropertyA" ReadOnly="True" Reorderable="True" Resizable="True"
                                    ShowSortIcon="False" UniqueName="Entity" Visible="True">
                                <telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False" DataField="PropertyB"
                                    Display="True" HeaderText="PropertyB" ReadOnly="True" Reorderable="False"
                                    Resizable="True" ShowSortIcon="False" UniqueName="CodeAttribute" Visible="True">
                                <telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False" DataField="PropertyC"
                                    Display="True" HeaderText="PropertyC" ReadOnly="True" Reorderable="True"
                                    Resizable="True" ShowSortIcon="False" UniqueName="DescriptionAttribute" Visible="true">
                                <telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False" DataField="PropertyD"
                                    Display="True" HeaderText="PropertyD" ReadOnly="True" Reorderable="True"
                                    Resizable="True" ShowSortIcon="False" UniqueName="OptionAttribute" Visible="true">


DataBinding: 'Object' does not contain a property with the name 'Code'.

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: DataBinding: 'Object' does not contain a property with the name 'Code'.

Stack Trace:

[HttpException (0x80004005): DataBinding: 'Object' does not contain a property with the name 'Code'.]
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +11394950
   Telerik.Web.UI.GridTableView.PopulateDataKeys(Object dataItem) +409
[GridException: There was a problem extracting DataKeyValues from the DataSource. Please ensure that DataKeyNames are specified correctly and all fields specified exist in the DataSource.]
   Telerik.Web.UI.GridTableView.PopulateDataKeys(Object dataItem) +1060
   Telerik.Web.UI.GridItemBuilder.CreateItems(GridGroupingContext group) +411
   Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +1169
   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +873
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +94
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +182
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +274
   Telerik.Web.UI.GridTableView.DataBind() +432
   Telerik.Web.UI.GridDataItem.OnExpand() +461
   Telerik.Web.UI.GridItem.set_Expanded(Boolean value) +295
   Telerik.Web.UI.RadCompositeDataBoundControl.OnPreRender(EventArgs e) +46
   System.Web.UI.Control.PreRenderRecursiveInternal() +113
   System.Web.UI.Control.PreRenderRecursiveInternal() +222
   System.Web.UI.Control.PreRenderRecursiveInternal() +222
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4201

Anyone got any advice.

This happens as the grid/page loads.


2 Answers, 1 is accepted

Sort by
Top achievements
Rank 1
answered on 22 Oct 2013, 09:36 AM
Hopefully this was missed by someone who can help.

Anyone? Still cant seem to fix this.
Telerik team
answered on 23 Oct 2013, 08:46 AM
Hi Ben,

It seems that the grid definition provided in the code snippet lacks ParentTableRelation tags which need to be configured when implementing a hierarchical grid structure:

Please build your relations accordingly and let us know about the result.

If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Asked by
Top achievements
Rank 1
Answers by
Top achievements
Rank 1
Telerik team
Share this question