我在一个页面里用repeate控件绑定了很多的内容。是好几个repeate控件。没有传什么ID进来我想问下,我可以实现这么多repeate控件中的数据分页么?如果可以,代码 和调用部分麻烦贴下,100分绝对给你。在线等哈

解决方案 »

  1.   

    repeate控件本身不支持分页功能。
    如果要分页。可以用吴旗娃的分页控件。
    每次只从db 取一页数据出来.绑定repeate
      

  2.   

     你可以 使用 PagedDataSource  来实现分页 
                 string sql = "select * from [Liuyan] order by id desc";
                DataSet Ds = DataAccess.DataAccess.GetDataSet(sql);            //使用PagedDataSource来实现分页
                  PagedDataSource pds = new PagedDataSource();
                pds.DataSource = Ds.Tables[0].DefaultView;
                pds.AllowPaging = true;
                pds.PageSize = 10;
      pds.CurrentPageIndex = Convert.ToInt32(this.labPage.Text) - 1;
                Repeater1.DataSource = pds;
     Repeater1.DataBind();
      

  3.   

    pageddatasource的分页原理是什么样的,是先抓取所有数据,还是动态抓取
      

  4.   

    用uploadpanel局部刷新一个一个的分页
      

  5.   

    asp.net夜话之七:ADO.NET介绍
    ADO.NET是对Microsoft ActiveX Data Objects (ADO)一个跨时代的改进,它提供了平台互用性和可伸缩的数据访问。由于传送的数据都是XML格式的,因此任何能够读取XML格式的应用程序都可以进行数据处理。事实上,接受数据的组件不一定要是ADO .NET组件,它可以是基于一个Microsoft Visual Studio的解决方案,也可以是任何运行在其它平台上的任何应用程序。以前做数据库访问的时候,需要一直与数据库保持连接,直到获取完所有满足需要的数据之后才会断开数据库连接,这种数据库访问方式称之为连接式数据访问技术。相比于以前的连接式数据访问技术,ADO.NET除了提供连接式数据访问技术之外,还提供了另一种断开式解决方案,那就是在内存中模拟一个数据库,也就是内存中的数据库。我们知道在实际的数据库技术中,每个数据库就是一个业务逻辑单元,一般来说这个数据库包含了实现一个应用软件或者一个网站所需要的全部数据。
    本篇中还讲述了自定义分页在数据库层的理论。用AjaxPro实现无刷新翻页效果及数据库分页技术介绍
    题外话:这其中大部分代码都是从我的项目中摘取出来的,不过为了演示整个程序的框架结构,所以在演示程序代码里不会有大量与实际相关的业务逻辑处理,但是这并不妨碍你利用这些理论做出复杂的、完善的应用。一、数据库分页理论在实际项目中经常会遇到一个表里有几K、几M以上的数据,而呈现给用户时并不会一下子都显示出来,所以都是分批展示给用户,这样一来可以减小网络传输量,二来也减轻服务器压力。本文展示了在数据库中如何实现分页,如何利用AjaxPro实现无刷新分页。
      

  6.   

    高效的分页就是每次只从数据库查询所需要的数据,像GridView这样的控件内置的分页效果效率是极其低下的,这种内置分页效果只适合于初学者。建议楼主多了解一下数据库分页查询的知识,这样你就能自己编写分页效果了。
      

  7.   

    http://topic.csdn.net/u/20090318/12/f09965c7-dcbc-4bb3-a0a3-3a8c267e49e0.html
    看看
    调试和代码全部指望别人 自己做什么呢?有思路 和主要代码就可以了!
      

  8.   

    http://topic.csdn.net/u/20090113/16/cac6480c-84ff-4ae3-8fa1-11cfa39fd8ea.html
      

  9.   

    参考:
    DataList分页:
    http://www.cnblogs.com/insus/articles/1418224.htmlGridView分页:
    http://www.cnblogs.com/insus/articles/1417957.html
      

  10.   

    在.cs页面中用下列函数:
    protected DataSet ds = new DataSet();
    ......
      private void GridViewBind()
        {
            string Connstring = ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
            SqlConnection con = new SqlConnection(Connstring);
            SqlDataAdapter sda = new SqlDataAdapter("select GroupID,Name,Phonenumber,Email,G_ID from [Group]", con);
            DataSet ds = new DataSet();
            sda.Fill(ds,"[Group]");
            int curPage = Convert.ToInt32(this.Label1.Text);  
            PagedDataSource ps = new PagedDataSource();
            ps.DataSource = ds.Tables["[Group]"].DefaultView;
            ps.AllowPaging = true;
            ps.PageSize = 10;
            ps.CurrentPageIndex = curPage - 1;
            this.LinkButton2.Enabled = true;
            this.LinkButton3.Enabled = true;
    前台.aspx:
     第<asp:Label ID="Label1" runat="server" Text="Label" ></asp:Label>页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        
        共<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>页&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click1">首页</asp:LinkButton>
        <asp:LinkButton ID="LinkButton2" runat="server" onclick="LinkButton2_Click">上一页</asp:LinkButton>
        <asp:LinkButton ID="LinkButton3" runat="server" onclick="LinkButton3_Click1">下一页</asp:LinkButton>
        <asp:LinkButton ID="LinkButton4" runat="server" onclick="LinkButton4_Click">末页</asp:LinkButton>
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
                onselectedindexchanged="DropDownList1_SelectedIndexChanged">
        </asp:DropDownList>
            if (curPage == 1)
            {
                this.LinkButton2.Enabled = false;
            }
            if (curPage == ps.PageCount)
            {
                this.LinkButton3.Enabled = false;
            }
            this.Repeater1.DataSource = ps;
            this.Repeater1.DataBind();
            Label2.Text = (ps.PageCount).ToString();
            DropDownList1.Items.Clear();
                for (int i = 1; i < ps.PageCount + 1; i++)
                {
                    DropDownList1.Items.Add(i.ToString());
                }
            DropDownList1.SelectedIndex = Convert.ToInt32(Label1.Text) - 1;
            
         
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            this.Label1.Text = Convert.ToString(Convert.ToInt32(this.Label1.Text) - 1);
            this.GridViewBind();
        }    protected void LinkButton1_Click1(object sender, EventArgs e)
        {
            this.Label1.Text = "1";
            this.GridViewBind();
        }
        protected void LinkButton4_Click(object sender, EventArgs e)
        {
            this.Label1.Text = Label2.Text;
            this.GridViewBind();
        }
        protected void LinkButton2_Click(object sender, EventArgs e)
        {
            this.Label1.Text = Convert.ToString(Convert.ToInt32(this.Label1.Text) - 1);
            this.GridViewBind();
        }
        protected void LinkButton3_Click1(object sender, EventArgs e)
        {
            this.Label1.Text=Convert.ToString(Convert.ToInt32(this.Label1.Text)+1);
            this.GridViewBind();
        }
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.Label1.Text = DropDownList1.SelectedItem.Text;
            this.GridViewBind();  
      
        }
    把_部分改一下就可以了~
    我已经验证过了,记得给分啊~
    哈哈~
      

  11.   

    在.cs页面中用下列函数: 
    protected DataSet ds = new DataSet(); 
    ...... 
      private void GridViewBind() 
        { 
            string Connstring = ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString; 
            SqlConnection con = new SqlConnection(Connstring); 
            SqlDataAdapter sda = new SqlDataAdapter("select GroupID,Name,Phonenumber,Email,G_ID from [Group]", con); 
            DataSet ds = new DataSet(); 
            sda.Fill(ds,"[Group]"); 
            int curPage = Convert.ToInt32(this.Label1.Text);  
            PagedDataSource ps = new PagedDataSource(); 
            ps.DataSource = ds.Tables["[Group]"].DefaultView; 
            ps.AllowPaging = true; 
            ps.PageSize = 10; 
            ps.CurrentPageIndex = curPage - 1; 
            this.LinkButton2.Enabled = true; 
            this.LinkButton3.Enabled = true; 
            if (curPage == 1) 
            { 
                this.LinkButton2.Enabled = false; 
            } 
            if (curPage == ps.PageCount) 
            { 
                this.LinkButton3.Enabled = false; 
            } 
            this.Repeater1.DataSource = ps; 
            this.Repeater1.DataBind(); 
            Label2.Text = (ps.PageCount).ToString(); 
            DropDownList1.Items.Clear(); 
                for (int i = 1; i < ps.PageCount + 1; i++) 
                { 
                    DropDownList1.Items.Add(i.ToString()); 
                } 
            DropDownList1.SelectedIndex = Convert.ToInt32(Label1.Text) - 1; 
            
        
        } 
        protected void Button1_Click(object sender, EventArgs e) 
        { 
            this.Label1.Text = Convert.ToString(Convert.ToInt32(this.Label1.Text) - 1); 
            this.GridViewBind(); 
        }     protected void LinkButton1_Click1(object sender, EventArgs e) 
        { 
            this.Label1.Text = "1"; 
            this.GridViewBind(); 
        } 
        protected void LinkButton4_Click(object sender, EventArgs e) 
        { 
            this.Label1.Text = Label2.Text; 
            this.GridViewBind(); 
        } 
        protected void LinkButton2_Click(object sender, EventArgs e) 
        { 
            this.Label1.Text = Convert.ToString(Convert.ToInt32(this.Label1.Text) - 1); 
            this.GridViewBind(); 
        } 
        protected void LinkButton3_Click1(object sender, EventArgs e) 
        { 
            this.Label1.Text=Convert.ToString(Convert.ToInt32(this.Label1.Text)+1); 
            this.GridViewBind(); 
        } 
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) 
        { 
            this.Label1.Text = DropDownList1.SelectedItem.Text; 
            this.GridViewBind();  
      
        } 
    前台.aspx: 
    第 <asp:Label ID="Label1" runat="server" Text="Label" > </asp:Label>页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        
        共 <asp:Label ID="Label2" runat="server" Text="Label"> </asp:Label>页&nbsp;&nbsp;&nbsp;&nbsp; 
        <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click1">首页 </asp:LinkButton> 
        <asp:LinkButton ID="LinkButton2" runat="server" onclick="LinkButton2_Click">上一页 </asp:LinkButton> 
        <asp:LinkButton ID="LinkButton3" runat="server" onclick="LinkButton3_Click1">下一页 </asp:LinkButton> 
        <asp:LinkButton ID="LinkButton4" runat="server" onclick="LinkButton4_Click">末页 </asp:LinkButton> 
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
                onselectedindexchanged="DropDownList1_SelectedIndexChanged"> 
        </asp:DropDownList>