Results 1 to 2 of 2

Thread: How to add paging to a repeater that uses Membership provider as a datasource

  1. #1

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    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

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width