Bug in ColumnGroupDescriptor.CreateGroupSortExpression

5 posts, 0 answers
  1. Alex
    Alex avatar
    141 posts
    Member since:
    Mar 2010

    Posted 11 Jun 2012 Link to this post

    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);
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 12 Jun 2012 Link to this post

    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 >>

  3. Alex
    Alex avatar
    141 posts
    Member since:
    Mar 2010

    Posted 12 Jun 2012 Link to this post

    Duplicate post
  4. Alex
    Alex avatar
    141 posts
    Member since:
    Mar 2010

    Posted 12 Jun 2012 Link to this post

    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
  5. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 13 Jun 2012 Link to this post

    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 >>

Back to Top