使用ASP.NET中继器进行分页?

Eti*_*nne 1 c# vb.net asp.net repeater

我正在使用ASP.NET Repeater.

我的Repeater被称为myRepeater,我只想在每页显示20个项目.

可以使用ASP.NET Repeater完成此操作,如果是这样,我必须对下面的代码进行哪些更改?我希望能够利用分页.......... C#的例子也很好!!

 ' Define data objects
    Dim conn As SqlConnection
    Dim Comm As SqlCommand
    Dim reader As SqlDataReader

    conn = New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)

    Comm = New SqlCommand( _
    ("Select * from TableName"), conn)

    ' Open the connection
    conn.Open()

    ' Execute the category command
    reader = Comm.ExecuteReader()

    ' Bind the reader to the repeater..........
    myRepeater.DataSource = reader
    myRepeater.DataBind()

    ' Close the reader
    reader.Close()
    ' Close the connection
    conn.Close()
Run Code Online (Sandbox Code Playgroud)

提前致谢!!

Bra*_*ery 5

这篇文章可能会帮到你.您将不得不自己创建分页逻辑.我建议使用分页控件,你只需要一个"上一个"和一个"下一个",你可以根据你在分页数据集中的"where"来启用/禁用这些操作.