1

I am using PostSharp and RadGridView from Telerik. Some columns have custom data using a DataTypeConverter, which I am using to load a value from a property named Name of type AdvisableDictionary<Tkey, TValue>.

The grid has the filter button and when clicked will show a popup window with Excel-like filtering options.

However when I click this button, I get an error saying Failed to compare two elements in the array. This happens only for the columns with this type of data. I don't have much experience with PostSharp, but I think this is generated by PostSharp.

Here are the last lines from Output window from PostSharp, before it throws the exception:

The thread 0x3964 has exited with code 0 (0x0).

The thread 0x364 has exited with code 0 (0x0).

Step into: Stepping over non-user code 'TranslatableObject.get_Name'

Step into: Stepping over non-user code 'TranslatableObject.<Name>c__Binding1.GetValue'

Step into: Stepping over non-user code 'TranslatableObject.<Name>c__Binding1.get_LocationInfo'

Step into: Stepping over non-user code 'TranslatableObject.<Name>c__Binding.GetValue'

what can I do to resolve this error?

FluffyKitten
  • 13,824
  • 10
  • 39
  • 52
Tim
  • 152
  • 10
  • Could you please paste here the stack trace and full message of the exception? If you share a minimal example which reproduces this behavior, it would also help to identify the cause. – Antonín Procházka Jul 25 '17 at 08:28
  • Thanks! [Here](http://www.telerik.com/account/ClientsFiles/2e7a5d04-c0cc-4c2f-a835-8531ead667c4_ExcelLikeFiltering.zip?accesskey=76010F0054C6AF950F4458F5A0E88AD6643EF13E&expires=636369830483897924) is a sample project. I found a solution like in answer below. – Tim Jul 25 '17 at 09:14

2 Answers2

0

You can created a class to inherit AdvisableDictionary and implement IComparable.

public class AdvisableDictionary: IComparable
{
    //here add the code from your heart
}

HERE 1

HERE 2

So its simple in FilterConfirmed event of the FilterPopup you need to correct the value of the filter descriptor.

That's it.

Here is a sample prj. Please take a look. Have fun enjoy the c# programming.

That it's my solution, need to try, to be a boss, to try hard, to be happy :)

Ciprian Jijie
  • 479
  • 5
  • 20
-1

I figured out a solution: AdvisableDctionary does not implement IComparable used to sort the list of items.

I created a class to inherit AdvisableDictionary and implement IComparable and in FilterConfirmed event of the Filter Popup.

I corrected the value of the filter descriptor.

Clay
  • 4,999
  • 1
  • 28
  • 45
Tim
  • 152
  • 10