Exemplo n.º 1
0
    private void PageBind22()
    {
        string strWhere = string.Format("typeId={0} AND del=0 AND IsDel=0", typeId);

        if (TextBox1.Text.Trim() != "")
        {
            strWhere += string.Format(" AND title='{0}'", TextBox1.Text.Trim());
        }

        DataSet ds = tunnel_Index.GetList(strWhere);
        //DataTable dt = ds.Tables[0].Clone();
        //for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        //{
        //    if (m_UserLogin.LoginID.ToString().Trim() == ds.Tables[0].Rows[i]["userId"].ToString().Trim())
        //    {
        //        dt.Rows.Add(ds.Tables[0].Rows[i].ItemArray);
        //        break;
        //    }
        //    if (null != ds.Tables[0].Rows[i]["readUser"] && ds.Tables[0].Rows[i]["readUser"] != DBNull.Value)
        //    {
        //        string[] str = ds.Tables[0].Rows[i]["readUser"].ToString().Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
        //        for (int j = 0; j < str.Length; j++)
        //        {
        //            if (m_UserLogin.LoginID.ToString().Trim() == str[j])
        //            {
        //                dt.Rows.Add(ds.Tables[0].Rows[i].ItemArray);
        //                break;
        //            }
        //        }
        //    }
        //}

        PagedDataSource pds = new PagedDataSource();

        pds.DataSource  = ds.Tables[0].DefaultView;//设置数据源(DataTable类型)
        pds.AllowPaging = true;
        //每页显示的行数
        //pds.PageSize = 12;
        //AspNetPager1.RecordCount = ds.Tables[0].Rows.Count;
        //pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
        //pds.PageSize = AspNetPager1.PageSize;

        Repeater2.DataSource = ds;
        Repeater2.DataBind();
    }