private void BindData() { #region 组装查询条件 string whereStr = " 1 = 1 "; string _keywords = keywords.Replace("'", ""); if (!string.IsNullOrEmpty(_keywords)) { if (Utils.IsSafeSqlString(_keywords)) { whereStr += " and (name like '%" + _keywords + "%')"; } else { JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("recommend_course.aspx", "keywords={0}", "")); return; } } #endregion this.page = RequestHelper.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; BLL.course_info bll = new BLL.course_info(); this.rptList.DataSource = bll.GetListByPage("*", "View_RecommendCourse", whereStr, "ad_sort_id asc", this.page, this.pageSize); this.rptList.DataBind(); this.totalCount = bll.GetRecordCount("View_RecommendCourse", whereStr); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("recommend_course.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void BindData() { #region 组装查询条件 string whereStr = " 1 = 1 "; string _keywords = keywords.Replace("'", ""); if (!string.IsNullOrEmpty(_keywords)) { if (Utils.IsSafeSqlString(_keywords)) { whereStr += " and (name like '%" + _keywords + "%')"; } else { JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("unselected_course.aspx", "keywords={0}&group={1}&exaid={2}", "", this.group + "", this.exaid + "")); return; } } if (this.type > 0) { whereStr += " and category_id = " + this.type; this.ddlCategory.SelectedValue = this.type + ""; } #endregion this.page = RequestHelper.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; BLL.course_info bll = new BLL.course_info(); this.rptList.DataSource = bll.GetListByPage("*", "View_CourseList", whereStr, "ID DESC", this.page, this.pageSize); this.rptList.DataBind(); this.totalCount = bll.GetRecordCount("View_CourseList", whereStr); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("unselected_course.aspx", "keywords={0}&page={1}&group={2}&exaid={3}", this.keywords, "__id__", this.group + "", this.exaid + ""); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }