Пример #1
0
    private void InitData(int PageIndex, string name)
    {
        DataSet ds          = new DataSet();
        int     recordcount = 0; //获取总条数

        if (!string.IsNullOrEmpty(name))
        {
            try
            {
                txtSearchName.Text = name;
            }
            catch { }

            string where = "1=1";
            if (!string.IsNullOrEmpty(name))
            {
                where += " and title like '%" + name + "%'";
            }
            ds = bll.GetList(AspNetPager1.PageSize, PageIndex, where, out recordcount);
        }
        else
        {
            ds = bll.GetList(AspNetPager1.PageSize, PageIndex, "", out recordcount);
        }
        AspNetPager1.RecordCount = recordcount;
        this.rptBind.DataSource  = ds.Tables[0].DefaultView;
        this.rptBind.DataBind();
    }