xtreme: Here's a test aspx page with sorting in case there might be a detail here that could help (other non-relevant code deleted).
'********* DataGrid page w/sorting ************
<%@ Page Language="VB" Debug="false"%>
<%@Import Namespace = "Microsoft.VisualBasic"%>
<%@Import Namespace = "System"%>
<%@Import Namespace = "System.Web"%>
<%@Import Namespace = "System.Web.UI"%>
<%@Import Namespace = "System.Web.UI.WebControls"%>
<%@Import Namespace = "System.Web.UI.HtmlControls"%>
<%@Import Namespace = "System.Data"%>
<%@Import Namespace = "System.Data.OleDb"%>
<script runat="server">
Private Sub Page_Load(sender As Object, e As EventArgs)
If Not IsPostBack Then
GetSite("mysortstring"
End If
End Sub
Sub GetSites (sortField As String)
'code to connect and bind datagrid data...
End Sub
Sub Sort_Grid(ByVal Sender As Object, ByVal e As DataGridSortCommandEventArgs)
Dim SortExprs() As String
Dim CurrentSearchMode As String, NewSearchMode As String
Dim ColumnToSort As String, NewSortExpr as String
'Parse the sort expression - delimiter space
SortExprs = Split(e.SortExpression, " "
ColumnToSort = SortExprs(0)
'If a sort order is specified get it, else default is ascending
If SortExprs.Length() > 1 Then
CurrentSearchMode = SortExprs(1).ToUpper()
If CurrentSearchMode = "ASC" Then
NewSearchMode = "DESC"
Else
NewSearchMode = "ASC"
End If
Else 'If no mode specified, Default is descending
NewSearchMode = "ASC"
End If
'Derive the new sort expression.
NewSortExpr = ColumnToSort & " " & NewSearchMode
Dim iIndex As String
If ColumnToSort = "AwwSiteCode" Then
iIndex = 0
ElseIf ColumnToSort = "Group_Name" Then
iIndex = 1
ElseIf ColumnToSort = "Waterbody_Name" Then
iIndex = 2
ElseIf ColumnToSort = "Description" Then
iIndex = 3
ElseIf ColumnToSort = "LastDate" Then
iIndex = 7
ElseIf ColumnToSort = "ChemCt" Then
iIndex = 8
ElseIf ColumnToSort = "BacCt" Then
iIndex = 9
End If
lblA.Text = NewSortExpr
'alter the column's sort expression
dgGroups.Columns(iIndex).SortExpression = NewSortExpr
'Sort the data in new order
GetSites(NewSortExpr)
End Sub
</script>
<HTML>
<HEAD>
<title>Sites by County</title>
</HEAD>
<body background="images/lgtbrown.gif">
<form id="Form1" runat="server">
<div style="height:500px;overflow:auto;width:850px;">
<asp

ataGrid
id="dgGroups" runat="server"
AutogenerateColumns="false"
AllowSorting="True"
OnSortCommand="Sort_Grid"
BorderColor..
..
CellPadding="4">
<ItemStyle ForeColor="#330099" BackColor="white" Font-Size="9" ></ItemStyle>
<HeaderStyle Font-Size="10" horizontalalign="Center" verticalalign="Middle" ForeColor="#FFFFCC" BackColor="#990000"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="AWWSitecode" HeaderText="Site Code" SortExpression="AwwSiteCode"/>
<asp:BoundColumn DataField="Group_Name" HeaderText="Group Name" Sortexpression="Group_Name"/>
<asp:BoundColumn DataField="Waterbody_Name" HeaderText="Waterbody Name" Sortexpression="Waterbody_Name"/>
<asp:BoundColumn DataField="Description" HeaderText="Site Description" ItemStyle-width="160px" Sortexpression="Description"/>
<asp:BoundColumn DataField="Latitude" HeaderText="Latitude" DataFormatString="{0:f4}" />
<asp:BoundColumn DataField="Longitude" HeaderText="Longitude" DataFormatString="{0:f4}" />
<asp:BoundColumn DataField="LastDate" HeaderText="Last Date" DataFormatString="{0:dd MMM yyyy}" Sortexpression="LastDate"/>
<asp:BoundColumn DataField="ChemCt" HeaderText="#Chm" Sortexpression="ChemCt"/>
<asp:BoundColumn DataField="BacCt" HeaderText="#Bac" Sortexpression="BacCt"/>
<asp:BoundColumn DataField="BioCt" HeaderText="#Bio" Sortexpression="BioCt"/> </Columns>
</asp

ataGrid>
</DIV>
</form>
</body>
</HTML>