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

Automatic Grouping / Filtering does not work

4 Answers 60 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Deven
Top achievements
Rank 1
Deven asked on 08 Jun 2009, 08:48 AM
Hi,
I bind the grid as follows, does not allow me to group or filter on "Category" column. The data I am binding to it is a lookup class. The binding works perfectly, however the grouping  and filtering on that column is not available. 

 

 

<telerikGridView:RadGridView.Columns>

 

 

 

<telerikGridView:GridViewDataColumn HeaderText="Year" DataMemberPath="AcademicYear"/>

 

 

 

<telerikGridView:GridViewDataColumn HeaderText="Category" IsGroupable="True" DataMemberPath="Category.CodeDes"/>

 

 

 

<telerikGridView:GridViewDataColumn HeaderText="Days" DataMemberPath="EffectiveDays"/>

 

 

 

<telerikGridView:GridViewDataColumn HeaderText="Occurance" DataMemberPath="Occurances"/>

 

 

 

</telerikGridView:RadGridView.Columns>

 



Please help.

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 08 Jun 2009, 08:56 AM
Hello Deven,

You may need to implement IComparable and IEquatable<> for this property.

Regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Deven
Top achievements
Rank 1
answered on 08 Jun 2009, 09:15 AM

Vlad, thanks for your quick reply.
Since I cannot modify the actual class, I implemented a partial class in to my project as following, it still wont work. FYI CodeDes is string property.

public

 

partial class Category : IEquatable<string>, IComparable<string>

 

 

 {

 

#region IEquatable<string> Members

 

    public bool Equals(string other)

 

        {

return this.CodeDes == other; }

 

 

 

#endregion

#region

 

IComparable<string> Members

 

 

    public int CompareTo(string other)

 

        {

return this.CodeDes.CompareTo(other); }

 

 

#endregion

}

0
Vlad
Telerik team
answered on 11 Jun 2009, 08:57 AM
Hello Deven,

I've attached small example to illustrate you this. Although groping will work with simple IEquatable<> implementation looks like you will need to define equality operators to handle filtering - this was a bit unexpected since we thought that LINQ will handle this automatically.

Let me know how it goes.

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Deven
Top achievements
Rank 1
answered on 17 Jun 2009, 03:20 PM
Sorry for late reply. I took another route. I extended my entity with a property that will read description from the complex type. Since it was just one-off I was able to make this decision. I have not got a chance to look at your solution, but I promise when I hit back into this situation I will surely check it out.

Many thanks.
Deven
Tags
General Discussions
Asked by
Deven
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Deven
Top achievements
Rank 1
Share this question
or