The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.
NOTE:
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:
<
li
>
<
asp:TextBox
runat
=
"server"
ID
=
"SearchUserName"
/>
<
asp:Button
Text
=
"Search"
ID
=
"SearchUserButton"
runat
=
"server"
OnClientClick
=
"SearchUserButton_Click(); return false;"
/>
</
li
>
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:
function
SearchUserButton_Click() {
var
searchUserName = $get(
'<%= SearchUserName.ClientID %>'
);
var
urlParams = [];
if
(searchUserName !=
null
) {
if
(searchUserName.value !=
null
) {
_currentFilter =
"UserName.Contains(\""
+ searchUserName.value +
"\")"
;
Bind(urlParams);
}
}
}
HostType: Telerik.Sitefinity.Security.Web.UI.Principals.UsersList
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.
Attachments:
View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Learn MoreSubscribe to get all the news, info and tutorials you need to build better business apps and sites
Progress collects the Personal Information set out in our Privacy Policy and the Supplemental Privacy notice for residents of California and other US States and uses it for the purposes stated in that policy.
You can also ask us not to share your Personal Information to third parties here: Do Not Sell or Share My Info
We see that you have already chosen to receive marketing materials from us. If you wish to change this at any time you may do so by clicking here.
Thank you for your continued interest in Progress. Based on either your previous activity on our websites or our ongoing relationship, we will keep you updated on our products, solutions, services, company news and events. If you decide that you want to be removed from our mailing lists at any time, you can change your contact preferences by clicking here.