void GridView1_Sorting(object sender, GridViewSortEventArgs e)

{

DataView dv = (DataView)Session["Source"];       

if (Session["sortorder"] == "Ascending")       

{           

Session["sortorder"] = "Descending";           

dv.Sort = e.SortExpression + " ASC";        

}       

else       

{           

Session["sortorder"] = "Ascending";

dv.Sort = e.SortExpression + " DESC";

}       

Session["SavedSort"] = dv.Sort;       

LabelSortDisplay.Text = "GridView is sorted by: " +             dv.Sort.ToString();       

GridView1.DataBind();

}