
Patrick Gruhn
Top achievements
Rank 1
Patrick Gruhn
asked on 26 Oct 2010, 12:12 PM
Hello,
I have a TextColumn in my grid that contains data like this:
10
11
100
100A
I would like to sort this string like numbers (e.g. 10, 11,....), but I can't set simple the DataType of this Column because of the Characters.
Is there any way to sort like this?
Best regards,
Patrick
I have a TextColumn in my grid that contains data like this:
10
11
100
100A
I would like to sort this string like numbers (e.g. 10, 11,....), but I can't set simple the DataType of this Column because of the Characters.
Is there any way to sort like this?
Best regards,
Patrick
7 Answers, 1 is accepted
0
Hi Patrick Gruhn,
In the event you can compare the values in the way that you want. You should set the SortResult property of GridViewCustomSortingEventArgs to accomplish the sorting. Sincerely yours,
Svett
the Telerik team
You can achieve that by enabling the custom sorting feature. You can do it by setting the CustomDataOperation property of the column to CustomDataOperation.Sorting. Then you can handle the CustomSorting event:
private
void
radGridView1_CustomSorting(
object
sender, GridViewCustomSortingEventArgs e)
{
object
value1 = e.CellValue1;
object
value2 = e.CellValue2;
// If are equal: 0
// If value1 is less than value2: -1
// if value1 is greater than value2: 1
// e.SortResult =
}
In the event you can compare the values in the way that you want. You should set the SortResult property of GridViewCustomSortingEventArgs to accomplish the sorting. Sincerely yours,
Svett
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Hi Patrick Gruhn,
In the event you can compare the values in the way that you want. You should set the SortResult property of GridViewCustomSortingEventArgs to accomplish the sorting. Sincerely yours,
Nikolay
the Telerik team
You can achieve that by enabling the custom sorting feature. You can do it by setting the CustomDataOperation property of the column to CustomDataOperation.Sorting. Then you can handle the CustomSorting event:
private
void
radGridView1_CustomSorting(
object
sender, GridViewCustomSortingEventArgs e)
{
object
value1 = e.CellValue1;
object
value2 = e.CellValue2;
// If are equal: 0
// If value1 is less than value2: -1
// if value1 is greater than value2: 1
// e.SortResult =
}
In the event you can compare the values in the way that you want. You should set the SortResult property of GridViewCustomSortingEventArgs to accomplish the sorting. Sincerely yours,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0

Sangeetha
Top achievements
Rank 1
answered on 03 Jan 2011, 11:46 AM
I have following the version of telerik: 2010.1.10.504
I dont have the property for radgrid - CustomDataOperation property.
Please let me know how i can handle my own event for sorting.
I dont have the property for radgrid - CustomDataOperation property.
Please let me know how i can handle my own event for sorting.
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 03 Jan 2011, 12:01 PM
Hello,
If you don't have
which is obsolete in the later versions of the controls then you should now use
hope that helps
Richard
If you don't have
Me
.RadGridView1.Columns(0).CustomDataOperation = CustomDataOperation.Sorting
Me
.RadGridView1.MasterTemplate.EnableCustomSorting =
True
hope that helps
Richard
0

Sangeetha
Top achievements
Rank 1
answered on 03 Jan 2011, 12:03 PM
Hi
I found only ->
I found only ->
Me
.RadGridView1.MasterTemplate.EnableSorting =
True
and not
Me
.RadGridView1.MasterTemplate.EnableCustomSorting =
True
0

Richard Slade
Top achievements
Rank 2
answered on 03 Jan 2011, 12:09 PM
Hi,
It will either be one or the other. I suspect your older version still uses...
I.e. The CustomDataOperation can be found at the column level, not at the grid level.
hope that helps
Richard
It will either be one or the other. I suspect your older version still uses...
Me
.RadGridView1.Columns(0).CustomDataOperation = CustomDataOperation.Sorting
I.e. The CustomDataOperation can be found at the column level, not at the grid level.
hope that helps
Richard
0

Sangeetha
Top achievements
Rank 1
answered on 03 Jan 2011, 12:22 PM
Yup, it works. Thanks for the quick response.