Click here to Skip to main content
15,881,793 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
My question is:

Can a DataTable have sorting columns. I want to click on the column headers of my GridView that is being populated by a Fill DataTable code. Every time I try to look up Sorting columns they use a DataSet code.

If anyone knows of a tutorial or just an answer if this can be done I would really appreciate it.

Thanks.
Posted

1 solution

DataSet is just a collection of DataTables.

Unless you are using multiple DataTables, you can always use one DataTable to populate GridView.
 
Share this answer
 
Comments
Commish13 15-Nov-13 12:06pm    
I populated the GridView but now I'm trying to make the columns sort by clicking on the header. Do you know of any tutorials or have code that could help me make this possible?
Have you searched in Google? There are many awesome articles. Do a search. If you can't find, let me know here.
Commish13 16-Nov-13 10:34am    
Yes. But every time I try to find something the code is using a DataSet. My code is only displaying records using a DataTable in a GridView. Also I don't want to use a View State code because I'll be editing the records.
Commish13 17-Nov-13 18:22pm    
I thank you for your reply but, These examples use a ViewState. I'm using a Filter/Search feature on my GridView so every time I filter then Sort the column it clears out my Filter results.

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