我们如何在Repeater控件中仅显示5行. [英] How we can display only 5 rows in a Repeater control.

查看:52
本文介绍了我们如何在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

推荐答案

它需要分页.

检查这些链接

http://www.dotnetcurry.com/ShowArticle.aspx?ID=345 [ ^ ]

具有分页和排序功能的中继器 [
It requires paging.

Check these links

http://www.dotnetcurry.com/ShowArticle.aspx?ID=345[^]

Repeater with Paging and Sorting Features[^]


检查此博客
http://www.aspnettutorials.com/tutorials/controls/pageddatasource-vb.aspx [ ^ ]
--NDK
check this blog
http://www.aspnettutorials.com/tutorials/controls/pageddatasource-vb.aspx[^]
--NDK


作为您的问题首先,您将必须将重复器与PageSize 5绑定

As your Question First you will have to Bind Repeater with PageSize 5

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行.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆