Please visit my new Web Site https://coderstechzone.com
In many case studies we found that when sorting is required developers done this job in back end means running extra query in database even though he has an already disconnected record set in his hand like DataView which also create an overhead to the application. One can easily sort the DataView columns in both ascending and descending order. Its very simple and for showing or displaying any type of sorted data in your report or details page you can do it without connecting to the Database through disconnected DataView. To define the sort direction we can use ASC or DESC keyword after the column name. For multiple column we just add comma separator for each column.
Code Example is given below:
// Create DataView from a DataTable Instance
DataView DV = datatable1.DefaultView;
// If you do not define sorting order then default Ascending order will be applied
DV.Sort = "ProductName ASC, CategoryName ASC, Price DESC";
For more details on DataTable or DataView CLICK HERE.
0 comments:
I WOULD BE DELIGHTED TO HEAR FROM YOU