private void TxtShow(Repeater dlt)
    {
        string temp = this.cont.Text;
        int cont = Convert.ToInt32(temp);
        SqlConnection con = DBHelper.Conn();
        string sql = "select * from LeaveWord";
        SqlDataAdapter sda = new SqlDataAdapter();
        sda.SelectCommand = new SqlCommand(sql, con);
        DataSet ds = new DataSet();
        sda.Fill(ds,"LeaveWord");
        System.Web.UI.WebControls.PagedDataSource ps = new PagedDataSource();
        ps.DataSource = ds.Tables[0].DefaultView;
        ps.AllowPaging = true;
        ps.PageSize = 2;
        ps.CurrentPageIndex = cont - 1;
        UP.Enabled = true;
        Down.Enabled = true;
        if (cont == 1)
        {
            UP.Enabled = false;
            Down.Enabled = true;
        }
        if (cont == ps.PageCount)
        {
            UP.Enabled = true;
            Down.Enabled = false;
        }
        dlt.DataSource = ds;
        dlt.DataBind();
    }
它全部都显示出来了,分页都没有效果。我找不出问题来,帮帮忙看一下吧!说详细一点
初始cont = "1"

解决方案 »

  1.   

    用ASPNETpager控件 分吧 方便
      

  2.   

    http://www.webdiyer.com/Controls/AspNetPager
      

  3.   

    DataGrid跟DataGridView有分页功能,但是在实际使用中,需要把所有数据读出来绑定到控件,这样是不太好的,尤其数据量很大的话.我们实际操作应该是显示那页的资料就读取那一页的数据AspNetPager分页控件是一个很好的选择
      

  4.   

    AspNetPager是第三方
    如果数据量不大,可以用自带的分页功能
    如果数据量大,可以用第三方,也可以用vs自带的objectdatasource 实现三层分页。
      

  5.   

    this.DataList1.DataSource =ps ;DataSet ds=new DataSet();   
    PagedDataSource objPage=new PagedDataSource();   
    objPage.DataSource=ds.Tables["user"].DefaultView;   
    objPage.AllowPaging=true;   
    objPage.PageSize=6;   
    int CurPage;   
    if(Request.QueryString["Page"]!=null)   
    CurPage=Convert.ToInt32(Request.QueryString["Page"]);   
    else   
    CurPage=1;   
    objPage.CurrentPageIndex=CurPage-1;   
    this.lblCurPage.Text="当前页:第"+CurPage.ToString()+"页";   
    this.DataList1.DataSource=objPage;   
    this.DataList1.DataBind();   aspnetpager分页控件
      

  6.   

    aspnetpager分页控件真的还可以,好多的人在用
      

  7.   

    DataList 分页,需要自己写
    或者引用第三方的也行 Aspnetpager分页控件
      

  8.   

    分页用DataPager控件,需要自己结合着存储过程来写