protected void ListFangDataBind() { //如果前端请求了分页 if (Request.QueryString["page"] != null) { //将当前的页数呈现在前端 _PageIndex = Convert.ToInt32(Request.QueryString["page"].ToString()); } if (Request["_XiTongSN"] != null) { _XiTongSN = Convert.ToInt32(Request["_XiTongSN"].ToString()); } if (Request["_BingGuanSN"] != null) { _BingGuanSN = Convert.ToInt32(Request["_BingGuanSN"].ToString()); } if (Request["_FangXingSN"] != null) { _FangXingSN = Convert.ToInt32(Request["_FangXingSN"].ToString()); } if (Request["_RuZhuStartDate"] != null) { _RuZhuStartDate = Request["_RuZhuStartDate"].ToString(); } if (Request["_TuiFangEndDate"] != null) { _TuiFangEndDate = Request["_TuiFangEndDate"].ToString(); } if (Request["style"] != null) { style = Convert.ToInt32(Request["style"].ToString()); } Hashtable _HashTable = MyView_FangJianTianKuCun.List4Page(_RuZhuStartDate, _TuiFangEndDate, false, 0, _XiTongSN, _BingGuanSN, _FangXingSN, "", 10, _PageIndex); Int32 RecordCountOfPage = (int)_HashTable["RecordCountOfPage"]; Int32 RecordCount = (int)_HashTable["RecordCount"]; Int32 PageCount = (int)_HashTable["PageCount"]; Int32 PageIndex = (int)_HashTable["PageIndex"]; Int32 PrePageIndex = (int)_HashTable["PrePageIndex"]; Int32 NextPageIndex = (int)_HashTable["NextPageIndex"]; DataTable RecordList = (DataTable)_HashTable["RecordList"]; #region 生成分页字串 if (PageCount <= 20) { _PageString.Append("<a href='###'>共" + RecordCount + "条数据,每页" + RecordCountOfPage + "条</a> <a href='UserDingFang.aspx?page=1&_RuZhuStartDate=" + _RuZhuStartDate + "&_TuiFangEndDate=" + _TuiFangEndDate + "&_XiTongSN=" + _XiTongSN + "&_BingGuanSN=" + _BingGuanSN + "&_FangXingSN=" + _FangXingSN + "&style=0" + "'>首页</a>"); for (int pb = 0; pb < PageCount; pb++) { if ((pb + 1) != PageIndex) { _PageString.Append("<a href='UserDingFang.aspx?page=" + (pb + 1) + "&_RuZhuStartDate=" + _RuZhuStartDate + "&_TuiFangEndDate=" + _TuiFangEndDate + "&_XiTongSN=" + _XiTongSN + "&_BingGuanSN=" + _BingGuanSN + "&_FangXingSN=" + _FangXingSN + "&style=0" + "'>" + (pb + 1) + "</a>"); } else { _PageString.Append("<a class=\"Items_Page_Seleted\">" + (pb + 1) + "</a>"); } } _PageString.Append("<a href='UserDingFang.aspx?page=" + PageCount + "&_RuZhuStartDate=" + _RuZhuStartDate + "&_TuiFangEndDate=" + _TuiFangEndDate + "&_XiTongSN=" + _XiTongSN + "&_BingGuanSN=" + _BingGuanSN + "&_FangXingSN=" + _FangXingSN + "&style=0" + "'>尾页</a>"); } else { Int32 _FristPage = PageIndex - 10; Int32 _LastPage = PageIndex + 9; if (_FristPage < 1) { _LastPage += (1 - _FristPage); _FristPage = 1; } else if (_LastPage > PageCount) { _FristPage -= (_LastPage - PageCount); _LastPage = PageCount; } _PageString.Append("<a href='###'>共" + RecordCount + "条数据,每页" + RecordCountOfPage + "条</a> <a href='UserDingFang.aspx?page=1&_RuZhuStartDate=" + _RuZhuStartDate + "&_TuiFangEndDate=" + _TuiFangEndDate + "&_XiTongSN=" + _XiTongSN + "&_BingGuanSN=" + _BingGuanSN + "&_FangXingSN=" + _FangXingSN + "&style=0" + "'>首页</a>"); for (int pb = _FristPage; pb <= _LastPage; pb++) { if ((pb) != PageIndex) { _PageString.Append("<a href='UserDingFang.aspx?page=" + (pb) + "&_RuZhuStartDate=" + _RuZhuStartDate + "&_TuiFangEndDate=" + _TuiFangEndDate + "&_XiTongSN=" + _XiTongSN + "&_BingGuanSN=" + _BingGuanSN + "&_FangXingSN=" + _FangXingSN + "&style=0" + "'>" + (pb) + "</a>"); } else { _PageString.Append("<a class=\"Items_Page_Seleted\">" + (pb) + "</a>"); } } _PageString.Append("<a href='UserDingFang.aspx?page=" + PageCount + "&_RuZhuStartDate=" + _RuZhuStartDate + "&_TuiFangEndDate=" + _TuiFangEndDate + "&_XiTongSN=" + _XiTongSN + "&_BingGuanSN=" + _BingGuanSN + "&_FangXingSN=" + _FangXingSN + "&style=0" + "'>尾页</a>"); } #endregion this.Lab_PageString1.Text = _PageString.ToString(); this.Griw_List1.DataSource = RecordList; this.Griw_List1.DataBind(); Texx_RuZhuStartDate.Text = _RuZhuStartDate; Texx_TuiFangEndDate.Text = _TuiFangEndDate; Texx_Style.Text = style.ToString(); }
protected void KuCunTianDataBind() { this.Griw_List.DataSource = MyView_FangJianTianKuCun.List(); this.Griw_List.DataBind(); }