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

problem with a complex DataKeyNames value

2 Answers 126 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel Cuba
Top achievements
Rank 1
Daniel Cuba asked on 12 May 2010, 10:25 PM
Hi.

I have a RadGrid that I populate with a collection of objects from the class A. This class has one property (propertyB) that is an instance of another class B. And this class B has a property(propertyString) that is an String.

In the design of RadGrid I put DataKeyNames="propertyB.propertyString". 

And I have the following error:

DataBinding: 'Namespace.A' doesn`t contain a property with the name 'propertyB.propertyString'.


I have seen that this schema function in another place. What is missing to me?

Thanks.

Regards

2 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 14 May 2010, 03:44 PM
Hi Daniel,

The reason for this error is because propertyB.propertyString is considered as a single property name from the topmost data item. Therefore, RadGrid cannot use this field. It may be able to databind and display the data columns bound to inner properties, but advanced grid operations like sorting and grouping will fail. You also cannot add inner properties as data key values, as they cannot be extracted.

You may need to modify the class A definition to add access to the inner properties as first-level properties of class A. If you cannot modify class A, you can create another wrapper object that will map nested properties to properties of the wrapper object.

Kind regards,
Veli
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Daniel Cuba
Top achievements
Rank 1
answered on 15 May 2010, 09:34 PM
Veli:

Thank you very much.

Your answer is very clear.  I did a new property in my class A to access to the inner property, like you say...

Regards,

Daniel

Tags
Grid
Asked by
Daniel Cuba
Top achievements
Rank 1
Answers by
Veli
Telerik team
Daniel Cuba
Top achievements
Rank 1
Share this question
or