I believe your ViewState("gdvAll") is a dataset from another Subroutine with some sort of SQL or other. This code will sort the data by Ascending or Descending alleviating you Page Problem:
Protected Sub gdvAll_OnSorting(ByVal sender As Object, ByVal e As GridViewSortEventArgs) Handles GridView1.Sorting
Dim sortingdirection, sortby
If e.SortDirection = "ASC" Then
sortingdirection = "DESC"
Else
sortingdirection = "ASC"
End If
sortby = e.SortExpression & " " & sortingdirection
Dim MyDataSet As New DataSet = ViewState("gdvAll")
Dim MyDataTable As New DataTable()
MyDataTable = MyDataSet.Tables(0)
Dim MyDataView As New DataView(MyDataTable)
MyDataView.Sort = sortby
gdvAll.DataSource = ViewState("gdvAll")
GridView1.DataBind()
End Sub
<asp:GridView ID="gdvAll" runat="server" AllowPaging="true" OnPageSize="10" AllowSorting="true" OnSorting="gdvAll1_OnSorting"
Style="vertical-align: middle;" HorizontalAlign="Center" OnPageIndexChanging ="ongdvPageIndex_Clicked"
AutoGenerateColumns="false" OnSelectedIndexChanged="OnSelectedIndexChanged" EnableSortingAndPagingCallbacks="true"
CssClass="Grid" AlternatingRowStyle-CssClass="alt" PagerStyle-CssClass="pgr">