1
我遇到了我的GridView中排序样式麻烦
风格,他们根本就没有被应用,无论是cellstyle,headerstyle,颜色等...SortedAscending /降序不工作
也许是因为路我正在排序我的数据视图?这就像框架没有看到列进行排序...
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();
}
试图正是你贴什么,仍然没有风格当我对列进行排序时,应用于TH或TD。 – francis 2011-06-02 10:57:36