예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["Users"] != null)
     {
         users = (Users)Session["Users"];
     }
     else
     {
         users = null;
         Response.Write("<script>parent.window.location.href='Login.aspx'</script>");
     }
     if (!IsPostBack)
     {
         int DataCount = UsersBLL.CountNumber(strWhere);                                                                                                               //共多少条记录
         int hPageSize = (DataCount % Convert.ToInt32(HCount.Value)) != 0 ? DataCount / Convert.ToInt32(HCount.Value) + 1 : DataCount / Convert.ToInt32(HCount.Value); //共多少页
         HPageSize.Value        = DataCount.ToString();
         HAllPage.Value         = hPageSize.ToString();
         this.RpNews.DataSource = UsersBLL.PageSelectUsers(Convert.ToInt32(HCount.Value), Convert.ToInt32(HNowPage.Value), strWhere, "UserId", "desc");
         this.RpNews.DataBind();
         BindData("");
     }
 }
예제 #2
0
    /// <summary>
    /// 加载绑定
    /// </summary>
    public void BindLoad()
    {
        if (txtName.Value.Trim().Length != 0)
        {
            strWhere += " and U_Name like '%" + txtName.Value.Trim() + "%'";
        }
        if (txtRealName.Value.Trim().Length != 0)
        {
            strWhere += " and U_RealName like '%" + txtRealName.Value.Trim() + "%'";
        }
        if (ddlType.SelectedValue != "全部")
        {
            strWhere += " and U_Type='" + ddlType.SelectedValue + "'";
        }

        int DataCount = UsersBLL.CountNumber(strWhere);                                                                                                               //共多少条记录
        int hPageSize = (DataCount % Convert.ToInt32(HCount.Value)) != 0 ? DataCount / Convert.ToInt32(HCount.Value) + 1 : DataCount / Convert.ToInt32(HCount.Value); //共多少页

        HPageSize.Value        = DataCount.ToString();
        HAllPage.Value         = hPageSize.ToString();
        this.RpNews.DataSource = UsersBLL.PageSelectUsers(Convert.ToInt32(HCount.Value), Convert.ToInt32(HNowPage.Value), strWhere, "U_Id", "desc");
        this.RpNews.DataBind();
    }