I have a list of numbers
and number-letter
and letter-number
.The type of my column is string .My data is like this :
1
14
3
S-34
2
36-1/E
26
S-14
20
S-2
19
36-1
30
35
S-1
34
but i want to sort like this :
1
2
3
14
20
25
30
35
36-1
36-1/E
S-1
S-2
S-14
S-34
But my code sort the data like this :
1
14
19
2
20
25
3
30
35
36-1
36-1/E
S-1
S-14
S-2
S-34
my code is:
List<ViewTestPackageHistorySheet> lstTestPackageHistorySheets = _reportTestPackageHistorySheetRepository.ShowReport(Id).OrderBy(i => i.JointNumber).ToList();
I changed the code below but failed.
List<ViewTestPackageHistorySheet> lstTestPackageHistorySheets = _reportTestPackageHistorySheetRepository.ShowReport(Id).OrderBy(i => Convert.ToInt32(i.JointNumber)).ToList();
Error is:
LINQ to Entities does not recognize the method 'Int32 ToInt32(System.String)' method, and this method cannot be translated into a store expression.