【发布时间】:2016-06-04 02:26:39
【问题描述】:
我有带有排序功能的 GridView,它工作得很好,但它只能工作一次,是的,这不是重复的,我发现了很多问题,但这对我没有帮助。请问它只排序一次有什么问题(就像方向没有改变)?
ViewState["sort"] = "ASC" --> is declared in PageLoad
protected void grid_sort(object sender, GridViewSortEventArgs e)
{
DataView sorting = new DataView(data); //data is global DataTable
if (ViewState["sort"].ToString() == "ASC")
ViewState["sort"] = "DESC";
else
ViewState["sort"] = "ASC";
sorting.Sort = e.SortExpression + " " + ViewState["sort"];
data = sorting.ToTable();
GridView1.DataSource = data;
GridView1.DataBind();
}
【问题讨论】:
-
请参阅"Should questions include “tags” in their titles?",其中的共识是“不,他们不应该”!
标签: c# asp.net sorting gridview