Click here to Skip to main content
15,880,608 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would very much like to be able to sort just the currently displayed page, i.e. 20 odd records, in a GridView. It often makes more sense this way, especially when the goal of sorting to more quickly locate a record. Are there any implementations or patterns I can look to for inspiration in going about achieving this?
Posted
Comments
Dholakiya Ankit 16-Sep-13 23:33pm    
why some one updating Posted 8-Feb-10 17:32pm question

I don't know, I would disagree with you on this, sorting shouldn't be specific to the current page, this will mislead the user eventually since he is looking for sorting to the whole data, I won't call sorting records from A-D if all fit in one page as sorting, I expect records of Z start showing when I sort descendingly.
 
Share this answer
 
Comments
irohanpatil 3-Feb-11 9:21am    
Suppose My Datatable Returns the 10000 record and the and page size is 100.
I want to see only the 100 row to be sort then what?
“Its valid requirement “
I have found a best solution for how to sort only current page in gridview in asp.net

Steps:-

1)Copy structure of the gridview in a datatable.
2)Then copy data of gridview in datatable.
3)Convert datatable to dataview (datatable doesn't have sort method).
4)Sort dataview by sort method.
5)Then again assign sorted data from datatable to gridview (not through datasource).

Go through the link to read more :-


Sorting only current page in a gridview in asp.net

 
Share this answer
 
v5

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