扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
private void grdProjTrace_SortCommand(object source, DataGridSortCommandEventArgs e) { this.grdProjTrace.CurrentPageIndex = 0; DataView dv = 得到数据代码; string strSort = ""; string strOrder ="";//排序方式。0,降序,1升序 if(ViewState["SortExpresstion"] != null) { strSort = ViewState["SortExpresstion"].ToString(); strSort = strSort.Substring(0,strSort.Length -1); strOrder = ViewState["SortExpresstion"].ToString(); strOrder = strOrder.Substring(strOrder.Length -1); } if(e.SortExpression == "CustomerName") { if(strSort != "CustomerName") { this.ViewState["SortExpresstion"] = ustomerName0"; dv.Sort = "CustomerName DESC"; } else { if(strOrder == "0") { this.ViewState["SortExpresstion"] = "CustomerName1"; dv.Sort = "CustomerName ASC"; } else { this.ViewState["SortExpresstion"] = "CustomerName0"; dv.Sort = "CustomerName DESC"; } } } if(e.SortExpression == "fullName") { if(strSort != "fullName") { this.ViewState["SortExpresstion"] = "fullName0"; dv.Sort = "fullName DESC"; } else { if(strOrder == "0") { this.ViewState["SortExpresstion"] = "fullName1"; dv.Sort = "fullName ASC"; } else { this.ViewState["SortExpresstion"] = "fullName0"; dv.Sort = "fullName DESC"; } } } this.grdProjTrace.DataSource = dv; this.grdProjTrace.DataBind(); } |
private void ChangePageDataBind() { DataView dv = 得到数据代码; string strSort = ""; string strOrder ="";//排序方式。0,降序,1升序 if(ViewState["SortExpresstion"] != null) { strSort = ViewState["SortExpresstion"].ToString(); strSort = strSort.Substring(0,strSort.Length -1); strOrder = ViewState["SortExpresstion"].ToString(); strOrder = strOrder.Substring(strOrder.Length -1); } if(this.ViewState["SortExpresstion"] != null) { if(strSort == "CustomerName") { if(strOrder == "1") { this.ViewState["SortExpresstion"] = "CustomerName1"; dv.Sort = "CustomerName ASC"; } else { this.ViewState["SortExpresstion"] = "CustomerName0"; dv.Sort = "CustomerName DESC"; } } } if(this.ViewState["SortExpresstion"] != null) { if(strSort == "fullName") { if(strOrder == "1") { this.ViewState["SortExpresstion"] = "fullName1"; dv.Sort = "fullName ASC"; } else { this.ViewState["SortExpresstion"] = "fullName0"; dv.Sort = "fullName DESC"; } } } this.grdProjTrace.DataSource = dv; this.grdProjTrace.DataBind(); } |
private void grdProjTrace_PageIndexChanged(object source, DataGridPageChangedEventArgs e) { try { try { this.grdProjTrace.CurrentPageIndex = e.NewPageIndex; } catch { this.grdProjTrace.CurrentPageIndex = 0; } this.ChangePageDataBind(); } catch(System.Exception errWS) { //异常 } } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者