We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Sorting Capability

Is there a way to customize the sort on certain columns? I am unsure of exactly how it is sorting, the ascending works correctly but it does not appear that the descending is working correctly, can i customize this within a certain event to handle it.
Thanks,

Hi,

Well, GridWeb's data sorting feature just works fine in both ascending and descending orders. You may use WebCells.Sort() method to include your desired columns in sorting range. I think you can try to add CellCommand Hyperlinks as a data sorting headers and handle GridWeb1_CellCommand event for your need.

Following code just sort the data in descending order, the data sort column is A here.

Sample code:

//Accessing the reference of the worksheet that is currently active
WebWorksheet sheet=GridWeb1.WebWorksheets[GridWeb1.ActiveSheetIndex];
//Sorting data in descending order from top to bottom, the data sorting range is A2:B13 and the
//sort column is A here (the fifth argument in the Sort() method i.e.., 0 denotes A column).
sheet.Cells.Sort(1,0,12,2,0,SortOrder.Descending,SortOrientation.SortTopToBottom,true);

For further reference, please check the source codes of the Data Sorting featured demo: http://www.aspose.com/demos/aspose.grid/description/common/sort.htm The demo projects get installed automatically on your system when you install Aspose.Grid.MSI installer, so you may open the projects into VS.NET and check the source codes.

Also, please check the doc topic: http://www.aspose.com/documentation/visual-components/aspose.grid-for-.net/sorting-data.html

Moreover, don't forget to use the latest version (2.0.0) of the control.

If you still find any issue, kindly do create a test project, zip it and post it here, we will check it soon.

Thank you.