views:

28

answers:

2

Hi all,

I am currently looking for a way to search though a MembershipUserCollection.

At the moment the user will pick the role they wish to see. this could return 100's if not 1000's of records which are paged in a repeater. on the same screen the user can type in part of the user name they wish to find and it should filter the data. I rather have the filtering done as part of a ajax call using jquery.

Filtering works but only on the page that is selected not on the other pages.

example below is a sample of how records are been returned.

Dim UserRoles As String() = Roles.GetUsersInRole(ddlusertype.SelectedItem.Text) 
Dim mem As MembershipUser = Nothing
Dim dt As New MembershipUserCollection

 For Each Str As String In UserRoles         
      mem = Membership.GetUser(Str)
      dt.Add(mem)
 next

and I am using the jquery plug-in uitablefilter to do the searching

A: 

Because the server-side is performing your paging, and the client-side runs jQuery, you can't directly access the information you need. That is, the records on different pages do not exist on the client side at the time of your filtering. If you perform the filtering within a server-side method, you could add the records you need (i.e. fill the page).

Mark Avenius
My current line of thinking would be to use linq to query to results. I think I can make the object Queryable. using jquery is a nice to have but not 100% needed.
Antony Delaney
That would work :-)
Mark Avenius
A: 

My working solution is as follows. I am simply using linq to query the array of users. This is server side and not client side.

Dim UserRoles As String() = Roles.GetUsersInRole(ddlusertype.SelectedItem.Text) 

Dim users = From a In UserRoles Where a.Contains(textbox1.text)

Dim mem As MembershipUser = Nothing
Dim dt As New MembershipUserCollection

 For Each Str As String In users
      mem = Membership.GetUser(Str)
      dt.Add(mem)
 next
Antony Delaney