Click here to Skip to main content
15,917,320 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi Every Buddy

when i click on the field of data grid , its not true Sorted by number ,
its sorted False ,
Please help me


Improve:

i want when i click in header field of Datagrid that column sort By numeric , but its Sort Like As String !

Note: my Data type is Number in DataBase
Posted
Updated 12-Nov-11 3:48am
v2

1 solution

You're going to need to provide more information if you want quality assistance with this.

I'm guessing that you have numerical data but are storing it in a strings. So it's sorting like this: 1, 11, 12, 2, 3, 4 instead of this: 1, 2, 3, 4, 11, 12? However you are putting data into the grid, you'll need to specify that it is numeric. If you want more help, please post the relevant code you are using to setup your grid.
 
Share this answer
 
Comments
thatraja 10-Nov-11 13:52pm    
I'm sure, you are right. Take a 5!
synctor 12-Nov-11 6:58am    
yes you guess Right ! its sorted string mode not numeric , but i dont have any code for Setup grid ! Can u help me i setup it for numeric Sort ?
Kschuler 14-Nov-11 9:20am    
If you are using a DataTable and binding it to the DataGridView, I would add a column to the DataTable and define it as Numeric. Then it will sort properly after binding in the grid. Here is MSDN on that:
http://msdn.microsoft.com/en-us/library/7hb99w3e.aspx
parvezmokashi 12-Nov-11 10:01am    
am trying it too if I found it I ll be back

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900