Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 30-Dec-11 0:19am
v2

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

VB
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()


And when you Link More Show then Display 5 Record

1) First you use Stored Procedure this:

SQL
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)User Bind Repeater On click


VB
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

I have Used and work fine. if any problem come then write code here.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900