Hello Del my friend,
I remember having this problem. The trick is to never rely on the order of the records within a DataTable. Use a DataView against the DataTable and then bind to the DataView. I have enclosed an example web page. The other benefit of doing it this way is if 2 or more web pages need the same data but ordered differenlty, they can use the same stored procedure and the DataView in the page will handle the custom ordering.
Kind regards
Scotty
Imports System.Data.SqlClient
Imports System.Data
Partial Class PageInitTest
Inherits System.Web.UI.Page
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
If Not IsPostBack Then
Dim conn As New SqlConnection("myconnectionstring")
Dim command As New SqlCommand("mySQL", conn)
Dim da As New SqlDataAdapter(command)
Dim tblData As New DataTable
da.Fill(tblData)
' now the sorting
Dim dv As New DataView(tblData)
' you can also do filtering to not show all of them
'dv.RowFilter = "MyField = 1"
dv.Sort = "MyField ASC" ' ASC or DESC
' then bind the control to the DataView, not the DataTable
dgdMyData.DataSource = dv
dgdMyData.DataBind()
conn.Close()
End If
End Sub
End Class