How to add paging to a repeater that uses Membership provider as a datasource
hi guys,
I am using a custom membership provider. I needed to bind a repeater to a membershipusercollection but the only way I could think of was this:
There is no method to return a lcollection of membership users by userid. I basically have a friends table with a userid and a frienduserid field. both are foreign keys to the user table. So say I am userid 1 and I have two friends userid 2 and userid 3.
I needed to get a collection of membership users who are my friends (user 2 and 3)
so I did this:
Code:
Dim lstAccountIDs As List(Of Integer) = bl.GetFriendsAccountByUserID(iUser)
Dim mUsers As New MembershipUserCollection
For Each a In lstAccountIDs
mUsers.Add(Membership.GetUser(a))
Next
I get their id's and add them to to list(of Integer)
then i loop through the list and get the particular user by id and add them to a membershipusercollection object.
I now need to add paging to my repeater control that uses that collection as a datasource. However the membership provider doesn't give me the ability to specify a pageindex or pagesize etc. It gives me those options in the GetAllUsers function but I need it to work in the above scenario. Can anyone please suggest a way forward. Thanks
Re: How to add paging to a repeater that uses Membership provider as a datasource
Hello,
In order to add that functionality, you are going to need to create it.
You are going to need to create an overload on your GetFriendsAccountByUserID method, that accept the pageIndex and pageSize parameters, and you are going to need to do the work of paginating the data that you get back from the database.
You are not going to get this for free.
Gary