GridView:
http://blog.csdn.net/21aspnet/article/details/1540301
排序:
DataView dv = dt.DefaultView;
string sort =(string)ViewState["SortExp"] + " " + (string)ViewState["SortDerect"];
dv.Sort = sort;
GvCourses.DataSource = dv;
GvCourses.DataBind();
其中, ViewState["SortExp"] = "ID" 为绑定的字段名称; ViewState["SortDerect"] = "ASC"; 控制升序还是降序;降序为“DESC“; 两者的顺序不能颠倒,否则找不到对应的列,报”Can't find the column"的错误;