searching for FBA users on SharePoint 2007

So, you created this big portal for your suppliers, customers or other in SharePoint. You have implemented FBA but now you want to search in this extensive list of people ?

Continuing on the FBA Codeplex solution by Stacy Draper, adding just a few lines of code can do this for you !

The FBA solution already has a Stored Procedure “Search User by Name”. You can use this (in addition you can also change this procedure to search on parts of the name).

 

Next, edit the UsersDisp.aspx file:

add in the content page the textfield and search button:

search on user name:

<form>      
<asp:textbox ID="tna" text="" runat="server"/>      
<asp:Button ID="searchbtn" OnClick="mkSarch" runat="server" text="Search"/>      
<asp:Button ID="clear" OnClick="mkEmpty" runat="server" text="Empty"/>      
</form&gt

;

Next, put some code in the script part of the page:

    protected void mkSearch(object sender, EventArgs e)
{
if (tna.Text != “”)
{
searchUser(tna.Text);
}else
{
FillGrid();
}

}

protected void mkEmpty(object sender, EventArgs e)
{
tna.Text=””;
FillGrid();
}

protected void searchUser(string searchValue)

{

MembershipUser user;
MembershipUserCollection users = new MembershipUserCollection() ;
users = Membership.FindUsersByName(searchValue);

MemberGrid.DataSource = users;
MemberGrid.DataBind();
}


Et voila, now you should have a fully functional search on your FBA management page!

About: Marijn

Marijn Somers (MVP) has over 14 years experience in the SharePoint world, starting out with SP2007. Over the years the focus has grown to Office 365, with a focus on collaboration and document management. He is a business consultant at Balestra and Principal Content Provider for "Mijn 365 Coach" that offers dutch employee video training. His main work tracks are around user adoption, training and coaching and governance. He is also not afraid to dig deeper in the technicalities with PowerShell, adaptive cards or custom formatting in lists and libraries. You can listen to him on the biweekly "Office 365 Distilled" podcast.


2 thoughts on “searching for FBA users on SharePoint 2007”

  1. Thanks for the information. Do you mind posting a copy of the userdisp.aspx file content? I am having trouble implement this solution.

Leave a Reply

Your email address will not be published. Required fields are marked *