so you can go like this.
1) Add SortExpression to GridView Template as well as set Allow Sorting = True in gridview properties
2) create on function which will give you sort expression and store it in your view state or any thing else as per your requirement. As well as it will also maintain the sort direction, you can also maintain it with view state or other way.
3) so while binding grid you can use that view state value for sort expression as well as sort direction.
4) so while you fire your dropdown selected index change for sorting by student name then also set the value of view state for sort expression as student name and sort direction as <code>asc</code> or <code>desc</code>.
5) while you are going to change your page index as that time sort your data view using previously stored sort expression and direction to maintain sorting.
Instead of using order by cause in direct query you can use <code>Default View</code> of <code>data-table</code> and apply Sorting on that view, it is better idea for gridview sorting.
you can refer this links...
Sorting GridView 1[
^]
Sorting GridView 2[
^]