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) { //异常 } } |
ASP编码教程:如何实现/使用缓存
[ASP]2015年4月15日ASP编码教程:asp缓存的分类
[ASP]2015年4月15日ASP编码教程:何谓ASP缓存/为什么要缓存
[ASP]2015年4月15日ASP编码教程:asp实现的sha1加密解密代码
[ASP]2015年4月15日ASP编码教程:asp执行带参数的sql语句实例
[ASP]2015年4月14日