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

Bug in ColumnGroupDescriptor.CreateGroupSortExpression

4 Answers 42 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 12 Jun 2012, 02:13 AM
There is a bug in this method (ColumnGroupDescriptor.CreateGroupSortExpression), where by it attempts to create the Expression "o.Key" instead of "o.XXX" (where XXX is the property name)
e.g. If I wanted to sort by MyEntity.Value, instead of creating an expression of "o.Value", it will attempt to create "o.Key"



*edit* I was suppose to title this post as GroupDescriptorBase.CreateGroupSortExpression (not ColumnGroupDescriptor) but I can not edit the title.

--------

Instance property 'Key' is not defined for type 'xxxxxx (type name)'

   at System.Linq.Expressions.Expression.Property(Expression expression, String propertyName)
   at Telerik.Windows.Data.GroupDescriptorBase.CreateGroupSortExpression(Expression groupingExpression)

---------


Class:
Telerik.Windows.Controls.GridView.ColumnGroupDescriptor, Telerik.Windows.Controls.GridView, Version=2012.1.326.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7

Method
Expression CreateGroupSortExpression(Expression expression);

4 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 12 Jun 2012, 07:41 AM
Hi,

How can we reproduce this exception? Can you send us a very little dummy project that reproduces it?

Thanks in advance.

Greetings,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Alex
Top achievements
Rank 1
answered on 12 Jun 2012, 10:18 PM
Duplicate post
0
Alex
Top achievements
Rank 1
answered on 12 Jun 2012, 10:20 PM
A really simple example is:
IGroupDescriptor groupDescriptor = ...... //From an IQueryableCollectionView bound to a RadGridView
ParameterExpression parameterExpression = Expression.Parameter(typeof(MyEntity));
Expression sortExpression = groupDescriptor.CreateGroupSortExpression(parameterExpression);

If the ColumnGroupDescriptor column was set to group by, e.g. MyEntityId, you would expect the sortExpression to be "Param_0.MyEntityId", instead it will attempt to do "Param_0.Key"

I can't access my ftp sites at the moment, I will try to open up a support ticket so I can upload the problem. I suspect whom ever from Telerik who coded this, simply did Expression.Property(expression, "Key") instead of Expression.Property(expression, key)


Support ticket id is:
553948
0
Rossen Hristov
Telerik team
answered on 13 Jun 2012, 08:29 AM
Hello,

You should use the CreateGroupKeyExpression method as I described in the other thread.

Kind regards,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
General Discussions
Asked by
Alex
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Alex
Top achievements
Rank 1
Share this question
or