本文介绍了我们如何在Repeater控件中仅显示5行.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

请告诉我;如何一次仅在Repeater控件中显示5行,并在底部显示更多链接以显示5条记录?

谢谢与问候,
Pravin

Hello All,

Please let me know; how we can display only 5 rows in a Repeater control at a time and show more link in the bottom to display more 5 records?

Thanks & Regards,
Pravin

推荐答案



Dim dt As DataTable = BL.BindRepeater()
    Dim objPds As New PagedDataSource()
    Repeater.DataSource = dt.DefaultView
    Repeater.AllowPaging = True
    objPds.PageSize = 5
    Repeater.DataSource = objPds
    Repeater.DataBind()



而当您链接更多显示"后显示5条记录

1)首先,您可以使用存储过程:



And when you Link More Show then Display 5 Record

1) First you use Stored Procedure this:

Select RowsDisplay.* from (Select
      ROW_NUMBER() over (order by A.projectID desc) as RowNumber, A.*
    from
(select *
 from TableName(Plz Write TableName Here)
where UserName =XYZ;
) as A

) as RowsDisplay
where
RowsDisplay.RowNumber> 5



2)用户绑定中继器单击




2)User Bind Repeater On click


Dim dt As DataTable = BL.MoreShow()
Dim objPds As New PagedDataSource()
objPds.DataSource = dt.DefaultView
objPds.AllowPaging = True<pre lang="vb">


objPds.PageSize = 5
Repeater.DataSource = objPds
Repeater.DataBind

我已经用过并且工作正常.如有问题,请在此处编写代码.


objPds.PageSize = 5
Repeater.DataSource = objPds
Repeater.DataBind

I have Used and work fine. if any problem come then write code here.


这篇关于我们如何在Repeater控件中仅显示5行.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 23:08