You can use the JQGridSortEventArgs passed to the Sorting event to detect the column being sorted and the sort direction. Here is an example of overridiing the default sorting logic:
<trirand:JQGrid runat="server" ID="JQGrid1" Width="600px" OnSorting="CustomSortingGrid_Sorting">
protected void CustomSortingGrid_Sorting(object sender, Trirand.Web.UI.WebControls.JQGridSortEventArgs e) { // Cancel the default sorting, which essentially sorts the clicked column e.Cancel = true; // Get data from the datasource DataTable dt = GetData(); // Set sorting to always sort using the ID column // You can change that using the event arguments e.SortExpression (column name) and // e.SortDirection (asc / desc) dt.DefaultView.Sort = "CustomerID " + e.SortDirection.ToString().ToUpper(); // Rebind the grid using the sorted DataTable JQGrid1.DataSource = dt; JQGrid1.DataBind(); }