Hello!
I have a question about sorting string columns in the RadGridView component.
Lets say I have the following rows;
- V1
- V2
- W1
- W2
When using the built-in sorting these are sorted as; V1, W1, V2, W2.
But here in Sweden the characters 'V' and 'W' are treated as separate characters.
So I would like these to be sorted as; V1, V2, W1, W2.
Is there some kind of setting I can use to resolve this or do I need to implement some kind of custom sorting?
Kind regards,
Fredrik
4 Answers, 1 is accepted
By default, the strings V1, W1, V2, W2 should be sorted as V1, V2, W1, W2. This can be observed in the sample project I've attached to my reply.
Nonetheless, if you wish to change this default order, you can implement custom sorting as suggested in this article.
Please let me know if you require any assistance in the process.
Regards,
Dilyan Traykov
Progress Telerik

Hello Dilyan!
Thanks for the fast reply.
Do you know if there is a setting in Windows that governs this?
I have tested this on two machines with the same regional settings and it works on one machine, but not the other;
https://www.screencast.com/t/h06zvc0sq8qt
Kind regards,
Fredrik
I do not believe there's a Windows setting to override this default behavior, but I believe you should be able to achieve the desired result by switching the culture in the Sorting event to en-US, for example, (or any other culture where the sorting is applied as expected) and then switch it back in the Sorted event. Here's what I have in mind:
private
CultureInfo currentCulture;
public
MainWindow()
{
InitializeComponent();
this
.grid.Sorting += Grid_Sorting;
this
.grid.Sorted += Grid_Sorted;
}
private
void
Grid_Sorted(
object
sender, GridViewSortedEventArgs e)
{
Thread.CurrentThread.CurrentCulture =
this
.currentCulture;
}
private
void
Grid_Sorting(
object
sender, GridViewSortingEventArgs e)
{
this
.currentCulture = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture =
new
CultureInfo(
"en-US"
);
}
Please let me know whether this would work for you.
Regards,
Dilyan Traykov
Progress Telerik

Hello Dilyan,
Sorry for the late reply.
Your solution works as it should.
Apparently Microsoft has decided to change the Finnish/Swedish sorting. So this has nothing to do with the RadGridView component.
https://msdn.microsoft.com/en-us/library/cc194877.aspx
Kind regards,
Fredrik