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

[Solved] Filtering enums does not respect DisplayAttribute annotations

4 Answers 128 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Aled
Top achievements
Rank 1
Aled asked on 02 May 2012, 01:47 PM
When binding a column to an enum type like this:
public enum Status_E
{
        [Display(Name = "Planned", ResourceType = typeof(LocalizationResources))]
        Planned = 1,
 
        [Display(Name = "Pending", ResourceType = typeof(LocalizationResources))]
        Pending,
 
        [Display(Name = "Payed", ResourceType = typeof(LocalizationResources))]
        Payed
}
//...
columns.Bound(typeof(Status_E), "Status")
//...

the data shows up OK (the display name is loaded from the resource) but in the filter dialog for the column the possible filters are not localized (you get to choose between Planned, Pending and Payed instead of the localized values in the resource).

Is there a workaround for that?

PS: Also, sorting the column sorts by the internal value of the elements (1, 2, 3). I'd expect it to sort by the display text in alphabetical order.

4 Answers, 1 is accepted

Sort by
0
Julien
Top achievements
Rank 1
answered on 09 May 2012, 10:41 AM
I've the same issue.

- Has this been resolved?
- Did you found a work around?
0
Atanas Korchev
Telerik team
answered on 09 May 2012, 11:40 AM
Hi,

 No, this is not supported yet. The good news is that we plan to add this feature for the next official release which is due in June.

Regards,
Atanas Korchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Julien
Top achievements
Rank 1
answered on 09 May 2012, 12:43 PM
Which part is supported? The translation part? 
Do you have already some details? Because I can wait until june to have the filter/Order on the translation, but I need to have this list with the correct text in cells before, so the translation will already be implemented now
0
Atanas Korchev
Telerik team
answered on 09 May 2012, 01:00 PM
Hello,

 As I said in my previous reply using the DisplayAttribute to localize enum values is not supported yet. I cannot suggest a workaround - this is just missing functionality.

Greetings,
Atanas Korchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
Grid
Asked by
Aled
Top achievements
Rank 1
Answers by
Julien
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or