private void BindData() { #region 组装查询条件 string whereStr = " 1 = 1 "; string _keywords = keywords.Replace("'", ""); if (!string.IsNullOrEmpty(_keywords)) { if (Utils.IsSafeSqlString(_keywords)) { whereStr += " and (Title like '%" + _keywords + "%')"; } else { JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("Manage.aspx", "keywords={0}", "")); return; } } #endregion this.page = RequestHelper.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; BLL.classroom_info bll = new BLL.classroom_info(); this.rptList.DataSource = bll.GetListByPage(whereStr, "ID DESC", this.page, this.pageSize); this.rptList.DataBind(); this.totalCount = bll.GetRecordCount(whereStr); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("Manage.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("classroom_list.aspx", "keywords={0}", "")); return; } } if (this.adminInfo.role_type == 2) { Model.user_info user = new BLL.user_info().GetModel(" phone = '" + this.adminInfo.user_name + "' "); if (user == null) { JscriptMsg("此用户没有创建课堂,请确认后重新登录", "/admin/login.aspx"); return; } whereStr += " and user_id = " + user.id; } #endregion this.page = RequestHelper.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; BLL.classroom_info bll = new BLL.classroom_info(); this.rptList.DataSource = bll.GetListByPage(whereStr, "ID DESC", this.page, this.pageSize); this.rptList.DataBind(); this.totalCount = bll.GetRecordCount(whereStr); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("classroom_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }