I found a much easier way, which allows you to still use the built in sorting/paging of the standard gridview...
create 2 labels. set them to be visible = false. I called mine lblSort1 and lblSortDirection1
then code 2 simple events... the page sorting, which writes to the text of the invisible labels, and the page index changing, which uses them...
Private Sub gridview_Sorting(sender As Object, e As GridViewSortEventArgs) Handles gridview.Sorting
lblSort1.Text = e.SortExpression
lblSortDirection1.Text = e.SortDirection
End Sub
Private Sub gridview_PageIndexChanging(sender As Object, e As GridViewPageEventArgs) Handles gridview.PageIndexChanging
gridview.Sort(lblSort1.Text, CInt(lblSortDirection1.Text))
End Sub
this is a little sloppier than using global variables, but I've found with asp especially that global vars are, well, unreliable...