Grid sorts by a column that is defined as string in the datasource. As a result, the order of the groups is like this:
Group 1
Group 10
Group 11
Group 2
Group 3
I cannot change the column type in the datasource because it might break too many other things. Adding
<telerik:GridTemplateColumn DataType="System.Int32"
to the grid markup did not help.
Is there anything else I can try?
-Stan
5 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 13 Jan 2012, 05:17 AM
Hello Stan,
Try setting SortExpression for the TemplateColumn.
-Shinu.
Try setting SortExpression for the TemplateColumn.
-Shinu.
0

Stan
Top achievements
Rank 1
answered on 13 Jan 2012, 01:40 PM
Shinu, no didn't work, but thanks for the suggestion.
What I also noted about the grid is that DataType property of the GridBoundColumn does not override the data source type. For example, if data source type is string, grid sorts alphanumeically even after DataType="System.Int32" for this column.
I've noticed that setting the DataType property to "System.String" enables searching by the begining of the string, but setting it to System.Int32 does not make grid to sort numerically if data source type is string.
So this maybe an issue of sorting and not grouping - I can't make grid to sort numerically on the string data type.
-Stan
What I also noted about the grid is that DataType property of the GridBoundColumn does not override the data source type. For example, if data source type is string, grid sorts alphanumeically even after DataType="System.Int32" for this column.
I've noticed that setting the DataType property to "System.String" enables searching by the begining of the string, but setting it to System.Int32 does not make grid to sort numerically if data source type is string.
So this maybe an issue of sorting and not grouping - I can't make grid to sort numerically on the string data type.
-Stan
0
Hi Stan,
The observed behavior is expected. In order for the automatic sorting to function properly the data type in the database should be integer. However, you could implement custom sorting to achieve your scenario. Please examine the Applying Custom Sort Criteria help article to see how the desired functionality can be implemented.
All the best,
Antonio Stoilkov
the Telerik team
The observed behavior is expected. In order for the automatic sorting to function properly the data type in the database should be integer. However, you could implement custom sorting to achieve your scenario. Please examine the Applying Custom Sort Criteria help article to see how the desired functionality can be implemented.
All the best,
Antonio Stoilkov
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now
0

Stan
Top achievements
Rank 1
answered on 23 Jan 2012, 02:47 PM
Antonio, I don't see how this example applies to my problem. Can the groups be sorted numerically if data source type is string?
-Stan
-Stan
0
Hello Stan,
I have assembled a sample project demonstrating the desired functionality. The idea is to convert the type to int when retrieving it from the database. Note that the Extension column in the Northwind database is nvarchar(4).
Greetings,
Antonio Stoilkov
the Telerik team
I have assembled a sample project demonstrating the desired functionality. The idea is to convert the type to int when retrieving it from the database. Note that the Extension column in the Northwind database is nvarchar(4).
Greetings,
Antonio Stoilkov
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now