Please note that the template has been revised to address the changes in Sitefinity 5.0 SP1 - build 5.0.2800
If you're experiencing any problems running the sample in the above mentioned version, please download the revised template - UsersListCustom and replace the old one in your ControlTemplates folder.
Many of you have requested an easier way to search for users in Sitefinity backend Users Administration. Such functionality can be really useful to ones managing projects with multiple users, where searching for a particular user may become a tedious task.
To address your feedback, we have scheduled the implementation of this feature for our upcoming Sitefinity 5.1 release. In the meantime, however, I'll list below a quick workaround that will allow you to enjoy the same functionality.
Let me elaborate a little bit on what we'll be doing. By default the control used to display the users in /Sitefinity/Administration/Users is being bound client-side, so we'll just modify the template used there slightly, to pass a desired value (username) to the service responsible for getting the users. With a minimum amount of intervention we'll end up having a textbox and a search button, which when clicked filters the list, returning those users who match (have in mind we're using sub-string match, so you can look for users by parts of their UserName as well).
What we're adding to the default template is pretty simple - a textbox for entering the UserName and a button to submit the data to the service. They are both added to the command actions ribbon on top of the users grid control:
"SearchUserButton_Click(); return false;"
We'll be handling the Click event with a client-side function which reads the value entered in the textbox and sets the filterExpression for the service:
You can find attached to this post a sample modified template ready to be extracted in your project, and you'll just need to map it in Sitefinity backend by going to Administration->Settings->Advanced->Controls->ViewMap and creating a new entry there. please fill in the boxes accordingly:
searchUserName = $get(
'<%= SearchUserName.ClientID %>'
urlParams = ;
+ searchUserName.value +
LayoutTemplatePath: enter here the application relative path to the template you've extracted in your project (for your convenience I'm also attaching a screenshot demonstrating the mapping settings in my local project.)
Save the changes and restart your application to make sure you're not loading the cached version of the template.
For more information on mapping external templates globally for Sitefinity, I believe you might find this great post by Josh Morales very useful.
You should now have the searchbox in your /Sitefinity/Administration/Users screen, enjoy the new feature you've added to your project and please do not hesitate to let us know of any other improvements or constructive feedback you might have on the product functionality. We'll be glad to address them.