【发布时间】:2011-06-02 09:53:26
【问题描述】:
我的网格视图中的排序样式有问题,它们根本没有被应用,无论是单元格样式、标题样式、颜色等...
也许是因为我对数据视图进行排序的方式?就像框架没有看到该列正在排序......
protected void dgvOpps_Sorting(object sender, GridViewSortEventArgs e)
{
string sortDirection = "ASC";
string lastDirection = ViewState["SortDirection"] as string;
if ((lastDirection != null) && (lastDirection == "ASC"))
sortDirection = "DESC";
ViewState["SortDirection"] = sortDirection;
ViewState["SortExpression"] = e.SortExpression;
string orderByCol = e.SortExpression;
DataTable dt;
if (Session["dgvOppsFilter"] != null)
dt = ldcrmClient.RetrieveOpportunitiesOfReseller(loggedUser.account_id, (string[])Session["dgvOppsFilter"], new string[0]);
else dt = ldcrmClient.RetrieveOpportunitiesOfReseller(loggedUser.account_id, new string[0], new string[0]);
DataView dv = new DataView(dt);
dv.Sort = e.SortExpression + " " + sortDirection;
Session.Add("dgvOppsSort", e.SortExpression + " " + sortDirection);
dgvOpps.DataSource = dv;
dgvOpps.DataBind();
}
【问题讨论】:
标签: c# asp.net sorting gridview