I'm trying to sort a gridview with the following code:
Protected Sub GridView1_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles GridView1.Sorting
Dim dataView1 As New Data.DataView(dt)
dataView1.Sort = e.SortExpression & " ASC"
GridView1.DataSource = dataView1
.. but it is giving me errors that it can't find the column being sorted. (IndexOutOfRangeException) I am filling datatable "dt" with an oledbdataadapter and setting it as the datasource for the gridview. This works successfully.
However after I bind the gridview, it seems like the datatable is becoming empty.. thus the error i'm getting. Please help!! It must be some tiny stupid mistake I'm making.