日期:2014-05-18 浏览次数:20860 次
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) { string sortExpression = e.SortExpression; if (ViewState["ifasc"].ToString() == "0")//0升序列 1降序 { SortGridView(sortExpression, " ASC"); ViewState["ifasc"] = "1"; } else { SortGridView(sortExpression, " DESC"); ViewState["ifasc"] = "0"; } } private void SortGridView(string sortExpression, string direction) { DataTable dt = (DataTable)(ViewState["dt"]); DataView dv = dt.DefaultView; dv.Sort = sortExpression + direction; GridView1.DataSource = dv; GridView1.DataBind(); }
------解决方案--------------------
用二楼的方法就可以
------解决方案--------------------
看三角形箭头的形状....
------解决方案--------------------